Class: Nydp::Builtin::StringLength

Inherits:
Object
  • Object
show all
Includes:
Base, Singleton
Defined in:
lib/nydp/builtin/to_string.rb

Instance Method Summary collapse

Methods included from Base

#builtin_invoke_1, #builtin_invoke_2, #builtin_invoke_3, #builtin_invoke_4, #handle_error, #inspect, #invoke, #invoke_1, #invoke_2, #invoke_3, #invoke_4, #name, #nydp_type, #to_s

Methods included from Helper

#cons, #list, #literal?, #pair?, #sig, #sym, #sym?

Methods included from Converter

#n2r, #r2n

Instance Method Details

#builtin_invoke(vm, args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/nydp/builtin/to_string.rb', line 13

def builtin_invoke vm, args
  arg = args.car
  val = case arg
        when String
          arg.length
        else
          0
        end
  vm.push_arg val
end