Class: Renalware::MonthPeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/renalware/month_period.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(month:, year:) ⇒ MonthPeriod

Returns a new instance of MonthPeriod.



7
8
9
10
11
12
# File 'lib/renalware/month_period.rb', line 7

def initialize(month:, year:)
  @month = month
  @year = year
  @start = Time.new(year, month, 1, 0, 0, 0)
  @finish = start.end_of_month.end_of_day
end

Instance Attribute Details

#finishObject (readonly)

Returns the value of attribute finish.



5
6
7
# File 'lib/renalware/month_period.rb', line 5

def finish
  @finish
end

#monthObject (readonly)

Returns the value of attribute month.



5
6
7
# File 'lib/renalware/month_period.rb', line 5

def month
  @month
end

#startObject (readonly)

Returns the value of attribute start.



5
6
7
# File 'lib/renalware/month_period.rb', line 5

def start
  @start
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/renalware/month_period.rb', line 5

def year
  @year
end

Instance Method Details

#to_rangeObject



14
15
16
# File 'lib/renalware/month_period.rb', line 14

def to_range
  start..finish
end