Class: Delorean::BaseModule::NodeCall
- Inherits:
-
Struct
- Object
- Struct
- Delorean::BaseModule::NodeCall
- Defined in:
- lib/delorean/base.rb
Overview
_e is used by Marty promise_jobs to pass promise-related information
Instance Attribute Summary collapse
-
#_e ⇒ Object
Returns the value of attribute _e.
-
#engine ⇒ Object
Returns the value of attribute engine.
-
#node ⇒ Object
Returns the value of attribute node.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#%(args) ⇒ Object
FIXME: % should also support string as args.
-
#+(args) ⇒ Object
add new arguments, results in a new NodeCall.
- #/(args) ⇒ Object
- #cloned_params ⇒ Object
- #evaluate(attr) ⇒ Object
Instance Attribute Details
#_e ⇒ Object
Returns the value of attribute _e
20 21 22 |
# File 'lib/delorean/base.rb', line 20 def _e @_e end |
#engine ⇒ Object
Returns the value of attribute engine
20 21 22 |
# File 'lib/delorean/base.rb', line 20 def engine @engine end |
#node ⇒ Object
Returns the value of attribute node
20 21 22 |
# File 'lib/delorean/base.rb', line 20 def node @node end |
#params ⇒ Object
Returns the value of attribute params
20 21 22 |
# File 'lib/delorean/base.rb', line 20 def params @params end |
Instance Method Details
#%(args) ⇒ Object
FIXME: % should also support string as args
47 48 49 50 51 |
# File 'lib/delorean/base.rb', line 47 def %(args) raise 'non-array arg to %' unless args.is_a?(Array) engine.eval_to_hash(node, args, cloned_params) end |
#+(args) ⇒ Object
add new arguments, results in a new NodeCall
54 55 56 57 58 |
# File 'lib/delorean/base.rb', line 54 def +(args) raise 'bad arg to %' unless args.is_a?(Hash) NodeCall.new(_e, engine, node, params.merge(args)) end |
#/(args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/delorean/base.rb', line 33 def /(args) case args when Array engine.eval_to_hash(node, args, cloned_params) when String evaluate(args) else raise 'non-array/string arg to /' end rescue StandardError => exc Delorean::Engine.grok_runtime_exception(exc) end |
#cloned_params ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/delorean/base.rb', line 21 def cloned_params # FIXME: evaluate() modifies params! => need to clone it. # This is pretty awful. NOTE: can't sanitize params as Marty # patches NodeCall and modifies params to send _parent_id. # This whole thing needs to be redone. @cloned_params ||= Hash[params] end |
#evaluate(attr) ⇒ Object
29 30 31 |
# File 'lib/delorean/base.rb', line 29 def evaluate(attr) engine.evaluate(node, attr, cloned_params) end |