Method: Exlibris::Primo::ChainGang::Search#method_missing

Defined in:
lib/exlibris/primo/chain_gang/search.rb

#method_missing(method, *args, &block) ⇒ Object

Dynamically sets chainable accessor for indexes and precisions Suitable for chaining, e.g.

Search.new.title_begins_with("Travels").
  creator_contains("Greene").search


84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/exlibris/primo/chain_gang/search.rb', line 84

def method_missing(method, *args, &block)
  if matches? method
    self.class.send(:define_method, method) { |value|
      index = indexize(method)
      index = (indexes_map[index] || index)
      precision = precisionize(method)
      precision = (precisions_map[precision] || precision)
      add_query_term value, index, precision
    }
    send method, *args, &block
  else
    super
  end
end