lib/gloo/objs/basic/integer.rb in gloo-0.6.1 vs lib/gloo/objs/basic/integer.rb in gloo-0.7.0
- old
+ new
@@ -28,11 +28,11 @@
#
# Set the value with any necessary type conversions.
#
def set_value( new_value )
unless new_value.is_a? Numeric
- self.value = $engine.convert( new_value, 'Integer', 0 )
+ self.value = $engine.converter.convert( new_value, 'Integer', 0 )
return
end
self.value = new_value.to_i
end
@@ -46,48 +46,27 @@
#
def self.messages
return super + %w[inc dec]
end
+ #
# Increment the integer
+ #
def msg_inc
i = value + 1
set_value i
$engine.heap.it.set_to i
return i
end
+ #
# Decrement the integer
+ #
def msg_dec
i = value - 1
set_value i
$engine.heap.it.set_to i
return i
- end
-
- # ---------------------------------------------------------------------
- # Help
- # ---------------------------------------------------------------------
-
- #
- # Get help for this object type.
- #
- def self.help
- return <<~TEXT
- INTEGER OBJECT TYPE
- NAME: integer
- SHORTCUT: int
-
- DESCRIPTION
- An integer (numeric) value.
-
- CHILDREN
- None
-
- MESSAGES
- inc - Increment the integer value by 1.
- dec - Decrement the integer value by 1.
- TEXT
end
end
end
end