class Fable::Value
Attributes
value[RW]
value=[RW]
value_object[RW]
Public Class Methods
create(value)
click to toggle source
# File lib/fable/value.rb, line 29 def self.create(value) case value when TrueClass, FalseClass converted_to_int = value ? 1 : 0 return IntValue.new(converted_to_int) when Integer return IntValue.new(value) when Numeric return FloatValue.new(value.to_f) when String return StringValue.new(value) when Path return DivertTargetValue.new(value) when InkList return ListValue.new(value) else return nil end end
new(value)
click to toggle source
Calls superclass method
Fable::RuntimeObject::new
# File lib/fable/value.rb, line 8 def initialize(value) super() self.value_object = value end
Public Instance Methods
bad_cast_exception(target_type)
click to toggle source
# File lib/fable/value.rb, line 53 def bad_cast_exception(target_type) return StoryError.new("Can't cast #{self.value_object} from #{OrderedValueTypes.key(self.value_type)} to #{target_type}") end
cast(new_type)
click to toggle source
# File lib/fable/value.rb, line 21 def cast(new_type) raise NotImplementedError end
copy()
click to toggle source
# File lib/fable/value.rb, line 49 def copy return self.class.create(value_object) end
to_s()
click to toggle source
# File lib/fable/value.rb, line 25 def to_s value_object.to_s end
truthy?()
click to toggle source
# File lib/fable/value.rb, line 17 def truthy? raise NotImplementedError end
value_type()
click to toggle source
# File lib/fable/value.rb, line 13 def value_type raise NotImplementedError end