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.

error     = 'errors.messages.unknown'
value     = Cuprum::Result.new(value: 'result value', error: error)
operation = IdentityOperation.new.call(value)
operation.value
#=> 'result value'
operation.success?
#=> false
operation.error
#=> '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 IdentityCommand

#initialize

Methods inherited from Command

#call, #initialize, #to_proc

Methods included from Steps

#step, #steps

Methods included from Currying

#curry

Methods included from Processing

#arity, #call, #process

Constructor Details

This class inherits a constructor from Cuprum::BuiltIn::IdentityCommand