Module: MicroFlip::CLI

Defined in:
lib/micro_flip.rb

Class Method Summary collapse

Class Method Details

.display_changes(hash, io = STDOUT) ⇒ Object



52
53
54
55
56
# File 'lib/micro_flip.rb', line 52

def self.display_changes(hash, io = STDOUT)
  hash.each do |key, value|
    io.puts "Flip: #{key} set to #{value}"
  end
end

.parse_args(argv) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/micro_flip.rb', line 44

def self.parse_args(argv)
  args = argv.dup
  #TODO handle case where we get default= and set the 2nd bit to empty string
  #TODO maybe use optparser for this?
  hashes = args.flat_map { |a| Hash[*a.split('=') ] }
  hashes.reduce(&:merge)
end