Class: DSeL::DSL::Nodes::API::Environment

Inherits:
Proxy::Environment show all
Defined in:
lib/dsel/dsl/nodes/api/environment.rb

Constant Summary

Constants included from Base::Environment

Base::Environment::DSEL_NODE_ACCESSOR, Base::Environment::DSEL_NODE_IVAR

Instance Method Summary collapse

Methods inherited from Proxy::Environment

#method_missing, #respond_to?

Methods included from Mixins::Environment::IvarExplorer

#_dsel_node_for_ivar, #method_missing

Methods included from Base::Environment

#Parent, #Root, #_dsel_self, #_dsel_shared_variables, #_dsel_variables, #instance_variables

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DSeL::DSL::Nodes::Proxy::Environment

Instance Method Details

#also(*args, &block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dsel/dsl/nodes/api/environment.rb', line 24

def also( *args, &block )
    # TODO: Store #last_call on Node at the instance level,
    # this global state can be interfered with by other DSLs.
    last_call = DSeL::API::Generator.last_call
    type      = last_call[:type]

    # Check to see if there is a handler that matches our possible object.
    # If so, treat it as object.
    # If not, use the last object and assume arguments.
    if last_call.include?( :object ) &&
        !_dsel_self.class.has_call_handler?( type, args.first )

        args.unshift last_call[:object]
    end

    send( type, *args, &block )

    self
end