class Numeric
Extensions to the Numeric class required by the fOOrth language system.
Public Instance Methods
foorth_embed()
click to toggle source
Convert this number to a form suitable for embedding in a source string.
Returns
-
An embeddable form of this number as a string.
# File lib/fOOrth/monkey_patch/numeric.rb, line 8 def foorth_embed self.to_s end
to_foorth_c()
click to toggle source
Convert this number to a single character string.
# File lib/fOOrth/monkey_patch/numeric.rb, line 13 def to_foorth_c as_int = Integer.foorth_coerce(self) if as_int < 0 || as_int > 1_114_111 error "F40: Can't convert #{self} to a character." else [as_int].pack('U') end end
to_foorth_n()
click to toggle source
Convert this numeric to a numeric. Return self.
# File lib/fOOrth/monkey_patch/numeric.rb, line 24 def to_foorth_n self end
to_foorth_r()
click to toggle source
Convert this numeric to a rational.
# File lib/fOOrth/monkey_patch/numeric.rb, line 29 def to_foorth_r self.rationalize end