Class: SaleSearch

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#organizationObject (readonly)

Returns the value of attribute organization.



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

def organization
  @organization
end

#showObject (readonly)

Returns the value of attribute show.



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

def show
  @show
end

#startObject (readonly)

Returns the value of attribute start.



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

def start
  @start
end

#stopObject (readonly)

Returns the value of attribute stop.



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

def stop
  @stop
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