Class: Renalware::MonthPeriod
- Inherits:
-
Object
- Object
- Renalware::MonthPeriod
- Defined in:
- lib/renalware/month_period.rb
Instance Attribute Summary collapse
-
#finish ⇒ Object
readonly
Returns the value of attribute finish.
-
#month ⇒ Object
readonly
Returns the value of attribute month.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(month:, year:) ⇒ MonthPeriod
constructor
A new instance of MonthPeriod.
- #to_range ⇒ Object
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
#finish ⇒ Object (readonly)
Returns the value of attribute finish.
5 6 7 |
# File 'lib/renalware/month_period.rb', line 5 def finish @finish end |
#month ⇒ Object (readonly)
Returns the value of attribute month.
5 6 7 |
# File 'lib/renalware/month_period.rb', line 5 def month @month end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
5 6 7 |
# File 'lib/renalware/month_period.rb', line 5 def start @start end |
#year ⇒ Object (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_range ⇒ Object
14 15 16 |
# File 'lib/renalware/month_period.rb', line 14 def to_range start..finish end |