Class: Renalware::Pathology::Results

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/pathology/results.rb

Overview

A view model representing the aggregation of observations by date.

Defined Under Namespace

Classes: RowBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(observations, observation_descriptions) ⇒ Results

Returns a new instance of Results.



12
13
14
15
# File 'app/models/renalware/pathology/results.rb', line 12

def initialize(observations, observation_descriptions)
  @observations = observations
  @observation_descriptions = observation_descriptions
end

Instance Attribute Details

#observation_descriptionsObject (readonly)

Returns the value of attribute observation_descriptions.



10
11
12
# File 'app/models/renalware/pathology/results.rb', line 10

def observation_descriptions
  @observation_descriptions
end

Instance Method Details

#map(&block) ⇒ Object



17
18
19
# File 'app/models/renalware/pathology/results.rb', line 17

def map(&block)
  to_a.map(&block)
end

#to_aObject



21
22
23
24
25
# File 'app/models/renalware/pathology/results.rb', line 21

def to_a
  observations_by_date.map do |observed_on, observations_of_the_same_date|
    build_row(observed_on, observations_of_the_same_date, observation_descriptions)
  end
end