Class: Renalware::Pathology::ObservationsDiff::Observation
- Inherits:
-
Object
- Object
- Renalware::Pathology::ObservationsDiff::Observation
- Defined in:
- app/presenters/renalware/pathology/observations_diff.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ Observation
constructor
A new instance of Observation.
- #observed_at ⇒ Object
- #result ⇒ Object
- #supercedes?(other) ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Observation
Returns a new instance of Observation.
29 30 31 |
# File 'app/presenters/renalware/pathology/observations_diff.rb', line 29 def initialize(hash) @hash = hash end |
Instance Method Details
#observed_at ⇒ Object
37 38 39 |
# File 'app/presenters/renalware/pathology/observations_diff.rb', line 37 def observed_at Time.zone.parse(hash.fetch(:observed_at, "1970-01-01")) end |
#result ⇒ Object
33 34 35 |
# File 'app/presenters/renalware/pathology/observations_diff.rb', line 33 def result hash.fetch(:result, 0) end |
#supercedes?(other) ⇒ Boolean
41 42 43 44 |
# File 'app/presenters/renalware/pathology/observations_diff.rb', line 41 def supercedes?(other) (observed_at > other.observed_at) || ((observed_at == other.observed_at) && result != other.result) end |