Class: Eyepiece::QuickSearch
- Inherits:
-
Module
- Object
- Module
- Eyepiece::QuickSearch
- Defined in:
- lib/eyepiece/quick_search.rb
Defined Under Namespace
Classes: Searcher
Instance Method Summary collapse
- #included(base) ⇒ Object
-
#initialize(*fields) ⇒ QuickSearch
constructor
A new instance of QuickSearch.
Constructor Details
#initialize(*fields) ⇒ QuickSearch
Returns a new instance of QuickSearch.
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/eyepiece/quick_search.rb', line 71 def initialize(*fields) @module = Module.new do define_method :like do |*txt, require_one: true| Searcher.call(*fields, scope: self, txt: txt, require_one: require_one) end define_method :mlike do |*txt, require_one: false| Searcher.call(*fields, scope: self, txt: txt, require_one: require_one) end end end |
Instance Method Details
#included(base) ⇒ Object
67 68 69 |
# File 'lib/eyepiece/quick_search.rb', line 67 def included(base) base.send(:extend, @module) end |