Class: Basic101::AbsFunction

Inherits:
Function show all
Defined in:
lib/basic101/abs_function.rb

Instance Method Summary collapse

Methods inherited from Function

#check_args

Instance Method Details

#call(runtime, args) ⇒ Object



13
14
15
16
17
# File 'lib/basic101/abs_function.rb', line 13

def call(runtime, args)
  check_args args, [BasicNumeric]
  value = args.first.eval(runtime)
  value.abs
end

#nameObject



9
10
11
# File 'lib/basic101/abs_function.rb', line 9

def name
  'ABS'
end