class AutomateIt::FieldManager::Struct

FieldManager::Struct

A FileManager driver that queries a data structure.

Public Instance Methods

lookup(search=nil) click to toggle source

See FieldManager#lookup

# File lib/automateit/field_manager.rb, line 61
def lookup(search=nil)
  return @struct if search.nil? or search == "*"
  ref = @struct
  for key in search.to_s.split("#")
    ref = ref[key]
  end
  if ref
    return ref
  else
    raise IndexError.new("can't find value for: #{search}")
  end
end
setup(opts={}) click to toggle source

Options:

  • :struct – Hash to use as the fields data structure.

Calls superclass method AutomateIt::Plugin::Driver#setup
# File lib/automateit/field_manager.rb, line 50
def setup(opts={})
  super(opts)

  if opts[:struct]
    @struct = opts[:struct]
  else
    @struct ||= {}
  end
end