Class: Code::Node::RegularFunctionArgument
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::RegularFunctionArgument
- Defined in:
- lib/code/node/regular_function_argument.rb
Instance Method Summary collapse
- #block? ⇒ Boolean
- #evaluate(**args) ⇒ Object
-
#initialize(argument) ⇒ RegularFunctionArgument
constructor
A new instance of RegularFunctionArgument.
- #keyword_splat? ⇒ Boolean
- #name ⇒ Object
- #splat? ⇒ Boolean
Constructor Details
#initialize(argument) ⇒ RegularFunctionArgument
Returns a new instance of RegularFunctionArgument.
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/code/node/regular_function_argument.rb', line 4 def initialize(argument) @block = argument.key?(:block) @splat = argument.key?(:splat) @keyword_splat = argument.key?(:keyword_splat) @name = argument.fetch(:name) if argument.key?(:default) @default = ::Code::Node::Code.new(argument.fetch(:default)) end end |
Instance Method Details
#block? ⇒ Boolean
31 32 33 |
# File 'lib/code/node/regular_function_argument.rb', line 31 def block? @block end |
#evaluate(**args) ⇒ Object
15 16 17 |
# File 'lib/code/node/regular_function_argument.rb', line 15 def evaluate(**args) @default ? @default.evaluate(**args) : ::Code::Object::Nothing.new end |
#keyword_splat? ⇒ Boolean
27 28 29 |
# File 'lib/code/node/regular_function_argument.rb', line 27 def keyword_splat? @keyword_splat end |
#name ⇒ Object
19 20 21 |
# File 'lib/code/node/regular_function_argument.rb', line 19 def name ::Code::Object::String.new(@name.to_s) end |
#splat? ⇒ Boolean
23 24 25 |
# File 'lib/code/node/regular_function_argument.rb', line 23 def splat? @splat end |