Class: Integer

Inherits:
Object show all
Defined in:
lib/core_ext.rb,
lib/list_augmenter.rb

Instance Method Summary collapse

Instance Method Details

#quantify(singular, plural = "#{singular}s") ⇒ Object



10
11
12
# File 'lib/core_ext.rb', line 10

def quantify(singular, plural="#{singular}s")
  "#{to_s} #{self == 1 ? singular : plural}"
end

#to_binObject



11
12
13
14
15
16
17
18
# File 'lib/list_augmenter.rb', line 11

def to_bin
  "0b" + to_s(2)
    .chars
    .padd_to_fours!
    .each_slice(4)
    .map(&:join)
    .join(" ")
end