class Fable::IntValue

Public Class Methods

new(value=0) click to toggle source
Calls superclass method Fable::Value::new
# File lib/fable/value.rb, line 67
def initialize(value=0)
  super(value)
end

Public Instance Methods

cast(new_type) click to toggle source
# File lib/fable/value.rb, line 71
def cast(new_type)
  if new_type == self.class
    return self
  end

  if new_type == FloatValue
    return FloatValue.new(self.value.to_f)
  end

  if new_type == StringValue
    return StringValue.new(self.value.to_s)
  end

  raise bad_cast_exception(new_type)
end
truthy?() click to toggle source
# File lib/fable/value.rb, line 63
def truthy?
  return value != 0
end
value_type() click to toggle source
# File lib/fable/value.rb, line 59
def value_type
  return OrderedValueTypes[IntValue]
end