Class: AutomateIt::TagManager::YAML

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

Overview

TagManager::YAML

A TagManager driver that reads tags from a YAML file.

Constant Summary

Constants inherited from Struct

Struct::TAG_NEGATION, Struct::TAG_TOKENIZER, Struct::TAG_WORD

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

#hosts_tagged_with, #tagged?, #tags, #tags_for

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 – File to read tags from. The file is preprocessed with ERB and must produce YAML content.



14
15
16
17
18
19
20
21
22
23
# 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

#suitability(method, *args) ⇒ Object

:nodoc:



7
8
9
# File 'lib/automateit/tag_manager/yaml.rb', line 7

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