Closed meineerde closed 13 years ago
Fantastic!
I did like the idea of Search.index, Search.search seems redundant :P
Generally, you'd use Spice::Search.node("recipe:debian")
. The actual search
method is then just called by method_missing
and parametrized with the correct index to search for.
I did like the idea of Search.index, Search.search seems redundant :P
Also, there never was a method called Search.index
. The generate_method
calls used index
as a variable which contained the names of the actual generated methods (node
, role
, client
, and user
). Metaprogramming at its best :)
Yes. Above, I was referring to the generated methods by saying Search.index (index as a var). Should have been clearer. I do like the new Search :)
Search is now called by method_missing. This allows to search for arbitrary data bags. I also added a convenience API. If only a string is passed instead of a Hash, it is search for with default parameters.
Also fixed is the escaping which now uses CGI::escape. The original escape somehow got injected into my test environment...
This pull request should by used instead of https://github.com/danryan/spice/pull/6. Sorry for the noise and confusion. Guess we really need some specs here.