Sha256: ba50f03fc131a76449c8042819fbc9ad9cf88cea2548047d756834c0b291f35c

Contents?: true

Size: 283 Bytes

Versions: 6

Compression:

Stored size: 283 Bytes

Contents

class Integer
  def pluralize desc
    if self == 0
      "no #{desc.to_s.pluralize}"
    elsif self == 1
      "#{self} #{desc}"
    else
      "#{self.dotted} #{desc.to_s.pluralize}"
    end
  end

  def dotted
    self.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1.').reverse
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lux-fw-0.5.37 ./lib/overload/integer.rb
lux-fw-0.5.36 ./lib/overload/integer.rb
lux-fw-0.5.35 ./lib/overload/integer.rb
lux-fw-0.5.34 ./lib/overload/integer.rb
lux-fw-0.5.33 ./lib/overload/integer.rb
lux-fw-0.5.32 ./lib/overload/integer.rb