Class: Float

Inherits:
Object show all
Defined in:
lib/fOOrth/monkey_patch/float.rb

Overview

Extensions to the Float class required by the fOOrth language system.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.foorth_coerce(arg) ⇒ Object

Coerce the argument to match my type.



9
10
11
12
13
# File 'lib/fOOrth/monkey_patch/float.rb', line 9

def self.foorth_coerce(arg)
  Float(arg)
rescue
  error "F40: Cannot coerce a #{arg.foorth_name} to a Float instance"
end

Instance Method Details

#foorth_coerce(arg) ⇒ Object

Coerce the argument to match my type.



16
17
18
19
20
# File 'lib/fOOrth/monkey_patch/float.rb', line 16

def foorth_coerce(arg)
  Float(arg)
rescue
  error "F40: Cannot coerce a #{arg.foorth_name} to a Float instance"
end