Class: Chef::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/search.rb

Class Method Summary collapse

Class Method Details

.add_query(name, index = :node) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/chef/search.rb', line 4

def self.add_query(name, index = :node)
  self.class.instance_eval do
    define_method "#{name}" do
      instance_variable_get("@#{name}")
    end

    define_method "#{name}=" do |value|
      instance_variable_set("@#{name}",value)
    end
  end

  instance_variable_set("@#{name}", QuerySyntax::Query.new(index))
end