class Object

Public Instance Methods

to_nif() click to toggle source

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.

# 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