Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/gcoder/gcode.rb
Instance Method Summary collapse
-
#to_nif ⇒ Object
A combination of to_i and to_f.
Instance Method Details
#to_nif ⇒ Object
A combination of to_i and to_f. If this object is nil?, nil is returned. If this object is an integer, to_i is returned. If this object is a floating point number, to_f is returned.
11 12 13 14 15 16 17 18 19 |
# File 'lib/gcoder/gcode.rb', line 11 def to_nif if nil? nil elsif to_i.to_s == self to_i else to_f end end |