Class: DSLCompose::Interpreter::Execution::MethodCalls::MethodCall

Inherits:
Object
  • Object
show all
Defined in:
lib/dsl_compose/interpreter/execution/method_calls/method_call.rb

Defined Under Namespace

Classes: InvalidDescriptionError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dsl_method, *args, &block) ⇒ MethodCall

Returns a new instance of MethodCall.



14
15
16
17
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 14

def initialize dsl_method, *args, &block
  @dsl_method = dsl_method
  @arguments = Arguments.new(dsl_method.arguments, *args)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



12
13
14
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 12

def arguments
  @arguments
end

#dsl_methodObject (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



31
32
33
34
35
36
37
38
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 31

def add_parser_usage_note note
  unless note.is_a?(String) && note.strip.length > 0
    raise InvalidDescriptionError, "The parser usage description `#{note}` is invalid, it must be of type string and have length greater than 0"
  end

  @parser_usage_notes ||= []
  @parser_usage_notes << note.strip
end

#method_nameObject



19
20
21
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 19

def method_name
  @dsl_method.name
end

#parser_usage_notesObject

return the list of notes which describe how the parsers are using this DSL



41
42
43
44
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 41

def parser_usage_notes
  @parser_usage_notes ||= []
  @parser_usage_notes
end

#to_hObject



23
24
25
26
27
# File 'lib/dsl_compose/interpreter/execution/method_calls/method_call.rb', line 23

def to_h
  {
    arguments: @arguments.to_h
  }
end