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?, #errors, #failure?, #halted?, #reset!, #success?, #value

Methods inherited from Command

#initialize

Methods included from Chaining

#chain, #chain!, #failure, #success, #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