Class: Orchestra::DSL::SingletonAdapter
- Inherits:
-
ObjectAdapter
- Object
- ObjectAdapter
- Orchestra::DSL::SingletonAdapter
- Defined in:
- lib/orchestra/dsl/object_adapter.rb
Instance Attribute Summary
Attributes inherited from ObjectAdapter
#collection, #method_name, #object
Instance Method Summary collapse
Methods inherited from ObjectAdapter
#build_context, build_step, #collection?, #context_class, #dependencies, determine_type, #initialize, #name
Constructor Details
This class inherits a constructor from Orchestra::DSL::ObjectAdapter
Instance Method Details
#execute(state) ⇒ Object
67 68 69 70 71 |
# File 'lib/orchestra/dsl/object_adapter.rb', line 67 def execute state deps = object_method.dependencies input = state.select do |key, _| deps.include? key end Invokr.invoke :method => method_name, :on => object, :with => input end |
#object_method ⇒ Object
73 74 75 |
# File 'lib/orchestra/dsl/object_adapter.rb', line 73 def object_method Invokr.query_method object.method method_name end |
#validate! ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/orchestra/dsl/object_adapter.rb', line 56 def validate! unless object.methods.include? method_name raise NotImplementedError, "#{object} does not implement method `#{method_name}'" end if collection? raise ArgumentError, "#{object} is a singleton; cannot iterate over collection #{collection.inspect}" end end |