Module: HtmlsnobRuby

Defined in:
lib/htmlsnob_ruby.rb,
lib/htmlsnob_ruby/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.4"

Class Method Summary collapse

Class Method Details

.run(paths, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/htmlsnob_ruby.rb', line 12

def self.run(paths, options = {})
  config_file = options[:config_file]

  if config_file && (config_file.end_with?(".yml") || config_file.end_with?(".yaml"))
    # YAML
    Tempfile.create(['converted_config', '.toml']) do |temp|
      temp.write(TomlRB.dump(YAML.load_file(config_file)))
      temp.rewind
      HtmlsnobRuby.run_simple(paths, temp.path)
    end
  else 
    # TOML
    HtmlsnobRuby.run_simple(paths, config_file)
  end
end