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

Method Summary

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

Constructor Details

This class inherits a constructor from Cuprum::Command