Class: GLCommand::ChainableContext

Inherits:
Context
  • Object
show all
Defined in:
lib/gl_command/chainable_context.rb

Instance Attribute Summary collapse

Attributes inherited from Context

#error, #full_error_message, #klass

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Context

#arguments, #assign_callable, #assign_parameters, #errors, #failure?, #in_chain?, #initialize, #inspect, #no_notifiable_error_to_raise, #no_notify?, #opts_hash, #raise_errors?, #returns, #success?

Constructor Details

This class inherits a constructor from GLCommand::Context

Instance Attribute Details

#calledObject

Returns the value of attribute called.



15
16
17
# File 'lib/gl_command/chainable_context.rb', line 15

def called
  @called
end

Class Method Details

.reserved_wordsObject



5
6
7
# File 'lib/gl_command/chainable_context.rb', line 5

def self.reserved_words
  %i[callable called failure no_notify raise_errors] + instance_methods
end

Instance Method Details

#chain?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/gl_command/chainable_context.rb', line 17

def chain?
  true
end

#chain_arguments_and_returnsObject



25
26
27
# File 'lib/gl_command/chainable_context.rb', line 25

def chain_arguments_and_returns
  @chain_arguments_and_returns.merge(to_h)
end

#initialize_chain_context(**arguments_and_returns) ⇒ Object

Called at the end of GLCommand::Context initialize



10
11
12
13
# File 'lib/gl_command/chainable_context.rb', line 10

def initialize_chain_context(**arguments_and_returns)
  @called = []
  @chain_arguments_and_returns = @klass.chain_arguments_and_returns(**arguments_and_returns)
end

#to_hObject



21
22
23
# File 'lib/gl_command/chainable_context.rb', line 21

def to_h
  arguments.merge(returns)
end