Class: Gugl::Search::Searcher
- Inherits:
-
Object
- Object
- Gugl::Search::Searcher
- Defined in:
- lib/search/searcher.rb
Constant Summary collapse
- DEFAULT_LIMIT =
5
Instance Attribute Summary collapse
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#query ⇒ Object
Returns the value of attribute query.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #authorize(&blk) ⇒ Object
- #display ⇒ Object
- #displayer ⇒ Object
- #displayer=(displayer) ⇒ Object
- #search ⇒ Object
- #search_and_display ⇒ Object
Instance Attribute Details
#limit ⇒ Object
Returns the value of attribute limit.
8 9 10 |
# File 'lib/search/searcher.rb', line 8 def limit @limit end |
#query ⇒ Object
Returns the value of attribute query.
8 9 10 |
# File 'lib/search/searcher.rb', line 8 def query @query end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
7 8 9 |
# File 'lib/search/searcher.rb', line 7 def results @results end |
Instance Method Details
#authorize(&blk) ⇒ Object
23 24 25 |
# File 'lib/search/searcher.rb', line 23 def (&blk) getter.searcher.(&blk) end |
#display ⇒ Object
17 18 19 20 21 |
# File 'lib/search/searcher.rb', line 17 def display results.each_with_index.map do |result, index| displayer.display result, index end end |
#displayer ⇒ Object
40 41 42 |
# File 'lib/search/searcher.rb', line 40 def displayer @displayer ||= mapped_displayer(:default) end |
#displayer=(displayer) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/search/searcher.rb', line 32 def displayer=(displayer) @displayer = if displayer.is_a?(Symbol) mapped_displayer(displayer) else displayer end end |
#search ⇒ Object
12 13 14 15 |
# File 'lib/search/searcher.rb', line 12 def search configure_getter @results = getter.get end |
#search_and_display ⇒ Object
27 28 29 30 |
# File 'lib/search/searcher.rb', line 27 def search_and_display search display end |