Class: Integer

Inherits:
Object show all
Defined in:
lib/overload/integer.rb,
lib/common/string_base.rb

Instance Method Summary collapse

Instance Method Details

#dottedObject



12
13
14
# File 'lib/overload/integer.rb', line 12

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

#pluralize(desc) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/overload/integer.rb', line 2

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

#string_idObject



40
41
42
# File 'lib/common/string_base.rb', line 40

def string_id
  StringBase.encode self
end