Class: Code::Object::Function
Instance Method Summary
collapse
#<=>, #==, #falsy?, #hash, #truthy?
Constructor Details
#initialize(parameters:, body:) ⇒ Function
Returns a new instance of Function.
4
5
6
7
|
# File 'lib/code/object/function.rb', line 4
def initialize(parameters:, body:)
@parameters = parameters
@body = body
end
|
Instance Method Details
#call(**args) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/code/object/function.rb', line 9
def call(**args)
operator = args.fetch(:operator, nil)
arguments = args.fetch(:arguments, [])
globals = multi_fetch(args, *::Code::GLOBALS)
if operator.nil? || operator == "call"
call_function(args: arguments, globals: globals)
else
super
end
end
|
25
26
27
|
# File 'lib/code/object/function.rb', line 25
def inspect
"function"
end
|
21
22
23
|
# File 'lib/code/object/function.rb', line 21
def to_s
""
end
|