Class: Renalware::Pathology::ObservationDateRange

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

Overview

Responsible for converting a collection of observations dates to a range.

Class Method Summary collapse

Class Method Details

.build(values) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'app/models/renalware/pathology/observation_date_range.rb', line 10

def self.build(values)
  # Must add a day to the range to cover observations that occur on the
  # same day after midnight. e.g. if we want observations up to
  # 2010-01-01 then we also want observations with the time stamp
  # 2010-01-01 10:30. If we don't add a day to the range then this
  # observation  will be omitted
  #

  Range.new(values.first, values.last + 1.day) if values.any?
end