Class: AutomateIt::FieldManager::YAML

Inherits:
Struct show all
Defined in:
lib/automateit/field_manager.rb

Overview

FieldManager::YAML

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

Constant Summary

Constants inherited from Plugin::Driver

Plugin::Driver::BASE_DRIVER_NAME

Constants included from Constants

Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE

Instance Attribute Summary

Attributes inherited from Plugin::Driver

#manager

Attributes inherited from Common

#interpreter

Instance Method Summary collapse

Methods inherited from Struct

#lookup

Methods inherited from Plugin::Driver

abstract_driver, #available?, base_driver, base_driver?, depends_on, inherited, manager_token

Methods inherited from Plugin::Base

#token, token

Methods inherited from Common

#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #superuser?, #writing, #writing=, #writing?

Constructor Details

This class inherits a constructor from AutomateIt::Common

Instance Method Details

#setup(opts = {}) ⇒ Object

Options:

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



88
89
90
91
92
93
94
95
96
97
# File 'lib/automateit/field_manager.rb', line 88

def setup(opts={})
  if filename = opts.delete(:file)
    contents = _read(filename)
    binder = interpreter.send(:binding)
    output = HelpfulERB.new(contents, filename).result(binder)

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

#suitability(method, *args) ⇒ Object

:nodoc:



81
82
83
# File 'lib/automateit/field_manager.rb', line 81

def suitability(method, *args) # :nodoc:
  return 5
end