Class: Cuprum::BuiltIn::IdentityOperation

Inherits:
IdentityCommand show all
Includes:
Operation::Mixin
Defined in:
lib/cuprum/built_in/identity_operation.rb

Overview

A predefined operation that returns the value or result it was called with.

Examples:

With a value.

operation = IdentityOperation.new.call('custom value')
operation.value
#=> 'custom value'
operation.success?
#=> true

With a result.

errors    = ['errors.messages.unknown']
value     = Cuprum::Result.new('result value', :errors => errors)
operation = IdentityOperation.new.call(value)
operation.value
#=> 'result value'
operation.success?
#=> false
operation.errors
#=> ['errors.messages.unknown']

Instance Attribute Summary

Attributes included from Operation::Mixin

#result

Method Summary

Methods included from Operation::Mixin

#call, #called?, #error, #failure?, #reset!, #status, #success?, #to_cuprum_result, #value

Methods inherited from Command

#initialize

Methods included from Chaining

#call, #chain, #chain!, #tap_result, #tap_result!, #yield_result, #yield_result!

Methods included from Processing

#arity, #call, #process

Constructor Details

This class inherits a constructor from Cuprum::Command