class AutomateIt::FieldManager::YAML

FieldManager::YAML

A FieldManager driver that reads its data structure from a file.

Public Instance Methods

setup(opts={}) click to toggle source

Options:

  • :file – Filename to read data structure from. Contents will be parsed with ERB and then handed to YAML.

Calls superclass method AutomateIt::FieldManager::Struct#setup
# File lib/automateit/field_manager.rb, line 88
def setup(opts={})
  if filename = opts.delete(:file)
    contents = _read(filename)
    binder = interpreter.instance_eval { binding() }
    output = HelpfulERB.new(contents, filename).result(binder)

    opts[:struct] = ::YAML::load(output)
  end
  super(opts)
end

Private Instance Methods

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