Class: DSLCompose::Interpreter::Execution::MethodCalls::MethodCall
- Inherits:
-
Object
- Object
- DSLCompose::Interpreter::Execution::MethodCalls::MethodCall
- Defined in:
- lib/dsl_compose/interpreter/execution/method_calls/method_call.rb
Defined Under Namespace
Classes: InvalidDescriptionError
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#called_from ⇒ Object
readonly
Returns the value of attribute called_from.
-
#dsl_method ⇒ Object
readonly
Returns the value of attribute dsl_method.
Instance Method Summary collapse
-
#add_parser_usage_note(note) ⇒ Object
the parser can provide usage notes for how this dsl is being used, these are used to generate documentation.
-
#initialize(dsl_method, called_from, *args, &block) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #method_name ⇒ Object
-
#parser_usage_notes ⇒ Object
return the list of notes which describe how the parsers are using this DSL.
- #to_h ⇒ Object
Constructor Details
#initialize(dsl_method, called_from, *args, &block) ⇒ MethodCall
Returns a new instance of MethodCall.
15 16 17 18 19 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 15 def initialize dsl_method, called_from, *args, &block @dsl_method = dsl_method @called_from = called_from @arguments = Arguments.new(dsl_method.arguments, called_from, *args) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
13 14 15 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 13 def arguments @arguments end |
#called_from ⇒ Object (readonly)
Returns the value of attribute called_from.
12 13 14 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 12 def called_from @called_from end |
#dsl_method ⇒ Object (readonly)
Returns the value of attribute dsl_method.
11 12 13 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 11 def dsl_method @dsl_method end |
Instance Method Details
#add_parser_usage_note(note) ⇒ Object
the parser can provide usage notes for how this dsl is being used, these are used to generate documentation
33 34 35 36 37 38 39 40 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 33 def add_parser_usage_note note unless note.is_a?(String) && note.strip.length > 0 raise InvalidDescriptionError.new("The parser usage description `#{note}` is invalid, it must be of type string and have length greater than 0", @called_from) end @parser_usage_notes ||= [] @parser_usage_notes << note.strip end |
#method_name ⇒ Object
21 22 23 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 21 def method_name @dsl_method.name end |
#parser_usage_notes ⇒ Object
return the list of notes which describe how the parsers are using this DSL
43 44 45 46 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 43 def parser_usage_notes @parser_usage_notes ||= [] @parser_usage_notes end |
#to_h ⇒ Object
25 26 27 28 29 |
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 25 def to_h { arguments: @arguments.to_h } end |