Class: DSLCompose::Interpreter::Execution::MethodCalls
- Inherits:
-
Object
- Object
- DSLCompose::Interpreter::Execution::MethodCalls
- Defined in:
- lib/dsl_compose/interpreter/execution/method_calls.rb,
lib/dsl_compose/interpreter/execution/method_calls/method_call.rb
Defined Under Namespace
Classes: MethodCall
Instance Attribute Summary collapse
-
#method_calls ⇒ Object
readonly
Returns the value of attribute method_calls.
Instance Method Summary collapse
- #add_method_call(dsl_method, called_from) ⇒ Object
-
#initialize ⇒ MethodCalls
constructor
A new instance of MethodCalls.
- #method_called?(method_name) ⇒ Boolean
- #method_calls_by_name(method_name) ⇒ Object
Constructor Details
#initialize ⇒ MethodCalls
Returns a new instance of MethodCalls.
9 10 11 |
# File 'lib/dsl_compose/interpreter/execution/method_calls.rb', line 9 def initialize @method_calls = [] end |
Instance Attribute Details
#method_calls ⇒ Object (readonly)
Returns the value of attribute method_calls.
7 8 9 |
# File 'lib/dsl_compose/interpreter/execution/method_calls.rb', line 7 def method_calls @method_calls end |
Instance Method Details
#add_method_call(dsl_method, called_from) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dsl_compose/interpreter/execution/method_calls.rb', line 17 def add_method_call(dsl_method, called_from, ...) # make sure we always have a variable which can be used in the exception message # set to nil first, so that if we get an exception while setting them # it wont break the error message generation dsl_method_name = nil dsl_method_name = dsl_method.name method_call = MethodCall.new(dsl_method, called_from, ...) @method_calls << method_call method_call rescue => e raise e, "Error while executing method #{dsl_method_name}\n#{e.}", e.backtrace end |
#method_called?(method_name) ⇒ Boolean
13 14 15 |
# File 'lib/dsl_compose/interpreter/execution/method_calls.rb', line 13 def method_called? method_name @method_calls.filter { |mc| mc.method_name == method_name }.any? end |
#method_calls_by_name(method_name) ⇒ Object
31 32 33 |
# File 'lib/dsl_compose/interpreter/execution/method_calls.rb', line 31 def method_calls_by_name method_name @method_calls.filter { |mc| mc.method_name == method_name } end |