Class: SyntaxTree::ArgsForward
Overview
ArgsForward represents forwarding all kinds of arguments onto another method call.
def request(method, path, **headers, &block); end
def get(...)
request(:GET, ...)
end
def post(...)
request(:POST, ...)
end
In the example above, both the get and post methods are forwarding all of their arguments (positional, keyword, and block) on to the request method. The ArgsForward node appears in both the caller (the request method calls) and the callee (the get and post definitions).
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#value ⇒ Object
readonly
- String
-
the value of the operator.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(_keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ ArgsForward
constructor
A new instance of ArgsForward.
Methods inherited from Node
#construct_keys, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:, comments: []) ⇒ ArgsForward
Returns a new instance of ArgsForward.
741 742 743 744 745 |
# File 'lib/syntax_tree/node.rb', line 741 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
739 740 741 |
# File 'lib/syntax_tree/node.rb', line 739 def comments @comments end |
#value ⇒ Object (readonly)
- String
-
the value of the operator
736 737 738 |
# File 'lib/syntax_tree/node.rb', line 736 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
747 748 749 |
# File 'lib/syntax_tree/node.rb', line 747 def accept(visitor) visitor.visit_args_forward(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
751 752 753 |
# File 'lib/syntax_tree/node.rb', line 751 def child_nodes [] end |
#deconstruct_keys(_keys) ⇒ Object
757 758 759 |
# File 'lib/syntax_tree/node.rb', line 757 def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end |
#format(q) ⇒ Object
761 762 763 |
# File 'lib/syntax_tree/node.rb', line 761 def format(q) q.text(value) end |