Sha256: 9b2a0696198ab6a21f8534575d9013c27afb7ea83dbbb3e74c1df7c3c8298109

Contents?: true

Size: 253 Bytes

Versions: 3

Compression:

Stored size: 253 Bytes

Contents

require_relative 'function'

module Basic101

  class AbsFunction < Function

    def name
      'ABS'
    end

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

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
basic101-0.4.0 lib/basic101/abs_function.rb
basic101-0.2.0 lib/basic101/abs_function.rb
basic101-0.1.0 lib/basic101/abs_function.rb