Class: ListAugmenter

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

Class Method Summary collapse

Class Method Details

.call(str) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/list_augmenter.rb', line 22

def self.call(str)
  return str unless str.include?("_cw_")

  str.lines.map do |line|
    next line unless line.strip.start_with?("Value:")

    value = line[/Value: (\d+)/, 1].to_i
    line.chomp +  " (#{value.to_bin})\n"
  end.join
end