Class: ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Commands::DefineMethodInContainer
- Inherits:
-
ConvenientService::Support::Command
- Object
- ConvenientService::Support::Command
- ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Commands::DefineMethodInContainer
- Includes:
- ConvenientService::Support::Delegate
- Defined in:
- lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(method:, container:, index:) ⇒ DefineMethodInContainer
constructor
A new instance of DefineMethodInContainer.
Methods included from ConvenientService::Support::Concern
Methods inherited from ConvenientService::Support::Command
Constructor Details
#initialize(method:, container:, index:) ⇒ DefineMethodInContainer
Returns a new instance of DefineMethodInContainer.
17 18 19 20 21 |
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 17 def initialize(method:, container:, index:) @method = method @container = container @index = index end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
13 14 15 |
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 13 def container @container end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
13 14 15 |
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 13 def index @index end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
13 14 15 |
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 13 def method @method end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb', line 23 def call ## # NOTE: Assignement in the beginning for easier debugging. # <<~RUBY.tap { |code| container.klass.class_eval(code, __FILE__, __LINE__ + 1) } def #{name} step, key, method_name = steps[#{index}], :#{key}, :#{name} ::ConvenientService.raise #{not_completed_step_error}.new(step: step, method_name: method_name) unless step.completed? ::ConvenientService.raise #{not_existing_step_result_data_attribute_error}.new(step: step, key: key) unless step.result.unsafe_data.has_attribute?(key) step.result.unsafe_data[key] end RUBY true end |