Class: Tire::Search::Multi::SearchDefinitions

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tire/multi_search.rb

Overview

Wraps the search definitions for Tire::Multi::Search

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSearchDefinitions

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

#namesObject (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

#sizeObject



31
32
33
# File 'lib/tire/multi_search.rb', line 31

def size
  @searches.size
end

#to_aObject



35
36
37
# File 'lib/tire/multi_search.rb', line 35

def to_a
  @searches
end