class AutomateIt::TagManager::YAML

TagManager::YAML

A TagManager driver that reads tags from a YAML file.

Public Instance Methods

setup(opts={}) click to toggle source

Options:

  • :file – File to read tags from. The file is preprocessed with ERB and must produce YAML content.

Calls superclass method AutomateIt::TagManager::Struct#setup
# File lib/automateit/tag_manager/yaml.rb, line 14
def setup(opts={})
  if filename = opts.delete(:file)
    contents = _read(filename)
    output = HelpfulERB.new(contents, filename).result

    text = AutomateIt::TagManager::TagParser.normalize(output)
    opts[:struct] = ::YAML::load(text)
  end
  super(opts)
end

Private Instance Methods

_read(filename) click to toggle source
# File lib/automateit/tag_manager/yaml.rb, line 25
def _read(filename)
  return File.read(filename)
end