Class: Code::Node::KeywordFunctionArgument

Inherits:
Code::Node
  • Object
show all
Defined in:
lib/code/node/keyword_function_argument.rb

Instance Method Summary collapse

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

Returns:



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

Returns:



24
25
26
# File 'lib/code/node/keyword_function_argument.rb', line 24

def keyword_splat?
  false
end

#nameObject



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

Returns:



20
21
22
# File 'lib/code/node/keyword_function_argument.rb', line 20

def splat?
  false
end