Class: Cuprum::BuiltIn::IdentityCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/cuprum/built_in/identity_command.rb

Overview

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

Examples:

With a value.

result = IdentityCommand.new.call('custom value')
result.value
#=> 'custom value'
result.success?
#=> true

With a result.

error  = 'errors.messages.unknown'
value  = Cuprum::Result.new(value: 'result value', error: error)
result = IdentityCommand.new.call(value)
result.value
#=> 'result value'
result.success?
#=> false
result.error
#=> 'errors.messages.unknown'

Direct Known Subclasses

IdentityOperation

Instance Method Summary collapse

Methods inherited from Command

#call, #to_proc

Methods included from Steps

#step, #steps

Methods included from Currying

#curry

Methods included from Processing

#arity, #call

Constructor Details

#initializeIdentityCommand

Returns a new instance of IdentityCommand.



27
28
29
# File 'lib/cuprum/built_in/identity_command.rb', line 27

def initialize
  super(&nil)
end