Class: Orchestra::DSL::ClassAdapter

Inherits:
ObjectAdapter show all
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, maybe_item = nil) ⇒ Object



85
86
87
88
89
90
# File 'lib/orchestra/dsl/object_adapter.rb', line 85

def execute state, maybe_item = nil
  instance = Invokr.inject object, :using => state
  args = [method_name]
  args << maybe_item if collection?
  instance.public_send *args
end

#object_methodObject



92
93
94
# File 'lib/orchestra/dsl/object_adapter.rb', line 92

def object_method
  Invokr.query_method object.instance_method :initialize
end

#validate!Object

Raises:

  • (NotImplementedError)


79
80
81
82
83
# File 'lib/orchestra/dsl/object_adapter.rb', line 79

def validate!
  return if object.instance_methods.include? method_name
  raise NotImplementedError,
    "#{object} does not implement instance method `#{method_name}'"
end