Class: Code::Node::RegularCallArgument
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::RegularCallArgument
- Defined in:
- lib/code/node/regular_call_argument.rb
Instance Method Summary collapse
- #block? ⇒ Boolean
- #evaluate(**args) ⇒ Object
-
#initialize(argument) ⇒ RegularCallArgument
constructor
A new instance of RegularCallArgument.
- #keyword_splat? ⇒ Boolean
- #name ⇒ Object
- #splat? ⇒ Boolean
Constructor Details
#initialize(argument) ⇒ RegularCallArgument
Returns a new instance of RegularCallArgument.
4 5 6 7 8 9 |
# File 'lib/code/node/regular_call_argument.rb', line 4 def initialize(argument) @splat = argument.key?(:splat) @keyword_splat = argument.key?(:keyword_splat) @block = argument.key?(:block) @value = ::Code::Node::Code.new(argument.fetch(:value)) end |
Instance Method Details
#block? ⇒ Boolean
17 18 19 |
# File 'lib/code/node/regular_call_argument.rb', line 17 def block? @block end |
#evaluate(**args) ⇒ Object
11 12 13 14 15 |
# File 'lib/code/node/regular_call_argument.rb', line 11 def evaluate(**args) object = @value.evaluate(**args) block? ? simple_call(object, :to_function, **args) : object end |
#keyword_splat? ⇒ Boolean
25 26 27 |
# File 'lib/code/node/regular_call_argument.rb', line 25 def keyword_splat? @keyword_splat end |
#name ⇒ Object
29 30 31 |
# File 'lib/code/node/regular_call_argument.rb', line 29 def name nil end |
#splat? ⇒ Boolean
21 22 23 |
# File 'lib/code/node/regular_call_argument.rb', line 21 def splat? @splat end |