Sha256: fddd715eb5f56080c11bcbba3adc19310a2510210414372a04cf0e269194b766

Contents?: true

Size: 332 Bytes

Versions: 3

Compression:

Stored size: 332 Bytes

Contents

module Basic101

  class RightFunction < Function

    def name
      'RIGHT$'
    end

    def call(runtime, args)
      check_args args, [BasicString, BasicNumeric]
      string, count = *args
      string = string.eval(runtime).to_string
      count = count.eval(runtime).to_integer
      string.right(count)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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