Class: PassSummary

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(organization, passes) ⇒ PassSummary

Returns a new instance of PassSummary.



4
5
6
7
8
9
# File 'app/models/pass_summary.rb', line 4

def initialize(organization, passes)
  @organization = organization
  @passes = passes
  @rows = {}
  process_passes
end

Instance Attribute Details

#organizationObject

Returns the value of attribute organization.



2
3
4
# File 'app/models/pass_summary.rb', line 2

def organization
  @organization
end

#passesObject

Returns the value of attribute passes.



2
3
4
# File 'app/models/pass_summary.rb', line 2

def passes
  @passes
end

#rowsObject

Returns the value of attribute rows.



2
3
4
# File 'app/models/pass_summary.rb', line 2

def rows
  @rows
end

Instance Method Details

#process_passesObject



11
12
13
14
15
16
17
# File 'app/models/pass_summary.rb', line 11

def process_passes
  @passes.each do |pass|
    pass_type_array = @rows.fetch(pass.pass_type, [])
    pass_type_array << pass
    @rows[pass.pass_type] = pass_type_array
  end
end