Class: MembershipSaleSearch

Inherits:
Object
  • Object
show all
Includes:
SearchByDates
Defined in:
app/models/membership_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) ⇒ MembershipSaleSearch

Returns a new instance of MembershipSaleSearch.



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

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

  @results = yield(results) if block_given?
end

Instance Attribute Details

#membership_typeObject (readonly)

Returns the value of attribute membership_type.



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

def membership_type
  @membership_type
end

Instance Method Details

#resultsObject



15
16
17
# File 'app/models/membership_sale_search.rb', line 15

def results
  @results ||= Order.membership_sale_search(self).select(&:has_membership?)
end