Class: Tire::Search::Multi::SearchDefinitions
- Inherits:
-
Object
- Object
- Tire::Search::Multi::SearchDefinitions
- Includes:
- Enumerable
- Defined in:
- lib/tire/multi_search.rb
Overview
Wraps the search definitions for Tire::Multi::Search
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
- #<<(value) ⇒ Object
- #[](name) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ SearchDefinitions
constructor
A new instance of SearchDefinitions.
- #size ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ SearchDefinitions
Returns a new instance of SearchDefinitions.
13 14 15 16 |
# File 'lib/tire/multi_search.rb', line 13 def initialize @names = [] @searches = [] end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
11 12 13 |
# File 'lib/tire/multi_search.rb', line 11 def names @names end |
Instance Method Details
#<<(value) ⇒ Object
18 19 20 21 |
# File 'lib/tire/multi_search.rb', line 18 def << value @names << value[:name] @searches << value[:search] end |
#[](name) ⇒ Object
23 24 25 |
# File 'lib/tire/multi_search.rb', line 23 def [] name @searches[ @names.index(name) ] end |
#each(&block) ⇒ Object
27 28 29 |
# File 'lib/tire/multi_search.rb', line 27 def each(&block) @searches.each(&block) end |
#size ⇒ Object
31 32 33 |
# File 'lib/tire/multi_search.rb', line 31 def size @searches.size end |
#to_a ⇒ Object
35 36 37 |
# File 'lib/tire/multi_search.rb', line 35 def to_a @searches end |