Class: DebrideToOkuribito::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/debride2okuribito.rb

Constant Summary collapse

FILE_NAME =
"okuribito.yml".freeze

Instance Method Summary collapse

Instance Method Details

#convert_yaml(argv) ⇒ Object



8
9
10
11
# File 'lib/debride2okuribito.rb', line 8

def convert_yaml(argv)
  hash = read_debride(argv)
  write_yaml(hash)
end

#read_debride(argv) ⇒ Object



13
14
15
16
17
# File 'lib/debride2okuribito.rb', line 13

def read_debride(argv)
  puts "--- Run debride and convert to yaml..."
  debride = Debride.run(argv)
  debride_to_hash(debride)
end

#write_yaml(hash) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/debride2okuribito.rb', line 19

def write_yaml(hash)
  yaml = YAML.dump(hash)

  # Workaround...
  yaml.gsub!(/^---\n/, "")
  yaml.gsub!(/^- /, "  - ")

  generate_file(yaml, FILE_NAME)
  puts "--- 'okuribito.yml' has been generated."
end