class Pathname::String::Float

Public Instance Methods

numeric?() click to toggle source
# File lib/extensions.rb, line 154
def numeric?() true end
s(p=2,ch='0') click to toggle source
# File lib/extensions.rb, line 155
def s(p=2,ch='0')
  return ch if self == 0.0 && p == 0 && !ch.nil?
  v = self.round
  v = (self > 0.0 ? self.ceil : self.floor) if v == 0 && !ch.nil?
  ret = p > 0 ? ("%.#{p}f" % self) : v.to_s
  (ret =~ /^0+(\.0+)?$/ && !ch.nil?) ? ch : ret
end