Class: MongoSearch::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo-search/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(search) ⇒ Builder

Returns a new instance of Builder.



3
4
5
# File 'lib/mongo-search/builder.rb', line 3

def initialize(search)
  @search = search
end

Instance Method Details

#exact(attr) ⇒ Object



11
12
13
# File 'lib/mongo-search/builder.rb', line 11

def exact(attr)
  @search << Matchers::ExactMatcher.new(attr)
end

#greater_than(attr, opts = nil) ⇒ Object



19
20
21
# File 'lib/mongo-search/builder.rb', line 19

def greater_than(attr, opts = nil)
  @search << Matchers::GreaterThanMatcher.new(attr, opts)
end

#intersect(attr) ⇒ Object



15
16
17
# File 'lib/mongo-search/builder.rb', line 15

def intersect(attr)
  @search << Matchers::IntersectMatcher.new(attr)
end

#less_than(attr, opts = nil) ⇒ Object



23
24
25
# File 'lib/mongo-search/builder.rb', line 23

def less_than(attr, opts = nil)
  @search << Matchers::LessThanMatcher.new(attr, opts)
end

#match(attr) ⇒ Object



7
8
9
# File 'lib/mongo-search/builder.rb', line 7

def match(attr)
  @search << Matchers::PartialMatcher.new(attr)
end

#sort_with(attr, opts = nil) ⇒ Object



27
28
29
# File 'lib/mongo-search/builder.rb', line 27

def sort_with(attr, opts = nil)
  @search.sorter = Sorter.new(attr, opts)
end