Sha256: 54d2c8cf20727a5acf963c6ce7924dfdccff741e4cda32c1bc56b09f06cb304a
Contents?: true
Size: 713 Bytes
Versions: 1
Compression:
Stored size: 713 Bytes
Contents
class Chef class Knife module PartialSearch def define_partial_search(keys) Chef::Search::Query.class_eval do @@keys = keys alias_method :old_search, :search unless method_defined? :old_search def search(type, query, args={}, &block) q = Chef::PartialSearch.new args[:keys] = @@keys if block_given? q.search(type, query, args) do |node_hash| n = FakeNode.new do |h,k| node_hash[k] end block.call(n) end else res = q.search(type, query, args) [res.first] end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knife-partial-search-0.0.1 | lib/chef/knife/partial_search/partial_search.rb |