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