class Elparser::SExpNumber

Public Class Methods

float(val) click to toggle source
# File lib/elparser.rb, line 87
def self.float(val)
  SExpNumber.new(:FLOAT, val)
end
int(val) click to toggle source
# File lib/elparser.rb, line 84
def self.int(val)
  SExpNumber.new(:INTEGER, val)
end
new(type, val) click to toggle source
# File lib/elparser.rb, line 91
def initialize(type, val)
  @type = type
  @val = val
end

Public Instance Methods

to_ruby() click to toggle source
# File lib/elparser.rb, line 108
def to_ruby
  value
end
to_s() click to toggle source
# File lib/elparser.rb, line 105
def to_s
  @val
end
value() click to toggle source
# File lib/elparser.rb, line 95
def value
  case @type
  when :INTEGER
    @val.to_i
  when :FLOAT
    @val.to_f
  else
    raise "Unknown type #{@type}:#{@val}"
  end
end