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