Class: SaleSearch

Inherits:
Object
  • Object
show all
Includes:
SearchByDates
Defined in:
app/models/sale_search.rb

Instance Attribute Summary collapse

Attributes included from SearchByDates

#organization, #start, #stop

Instance Method Summary collapse

Methods included from SearchByDates

#default_start, #default_stop, #start_with, #stop_with

Constructor Details

#initialize(terms) ⇒ SaleSearch

Returns a new instance of SaleSearch.



6
7
8
9
10
11
12
13
14
# File 'app/models/sale_search.rb', line 6

def initialize(terms)
  @organization = terms[:organization]
  @event        = terms[:event]
  @show         = terms[:show]
  @start        = start_with(terms[:start])
  @stop         = stop_with(terms[:stop])

  @results = yield(results) if block_given?
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



4
5
6
# File 'app/models/sale_search.rb', line 4

def event
  @event
end

#showObject (readonly)

Returns the value of attribute show.



4
5
6
# File 'app/models/sale_search.rb', line 4

def show
  @show
end

Instance Method Details

#resultsObject



16
17
18
# File 'app/models/sale_search.rb', line 16

def results
  @results ||= Order.sale_search(self).select(&:has_ticket?)
end