Class: LibTAD::DateCalculator::Period
- Inherits:
-
Object
- Object
- LibTAD::DateCalculator::Period
- Defined in:
- lib/types/date_calculator/period.rb
Overview
Calculated results for a requested period.
Instance Attribute Summary collapse
-
#calendardays ⇒ Integer
readonly
Number of calendar days in calculated period.
-
#enddate ⇒ ::LibTAD::TADTime::TADTime
readonly
The date the calculation ended on.
-
#holidays ⇒ ::LibTAD::DateCalculator::BusinessHoliday
readonly
Holidays which occur in the requested period.
-
#includeddays ⇒ Integer
readonly
Number of days calculated.
-
#skippeddays ⇒ Integer
readonly
Number of days which was skipped in the calculated period.
-
#startdate ⇒ ::LibTAD::TADTime::TADTime
readonly
The date the calculation started from.
-
#weekdays ⇒ ::LibTAD::DateCalculator::Weekdays
readonly
The spread of excluded or included weekdays in includeddays.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Period
constructor
A new instance of Period.
Constructor Details
#initialize(hash) ⇒ Period
Returns a new instance of Period.
33 34 35 36 37 38 39 40 41 |
# File 'lib/types/date_calculator/period.rb', line 33 def initialize(hash) @includeddays = hash.fetch('includeddays', nil) @calendardays = hash.fetch('calendardays', nil) @skippeddays = hash.fetch('skippeddays', nil) @startdate = ::LibTAD::TADTime::TADTime.new hash['startdate'] unless !hash.key?('startdate') @enddate = ::LibTAD::TADTime::TADTime.new hash['enddate'] unless !hash.key?('enddate') @weekdays = ::LibTAD::DateCalculator::Weekdays.new hash['weekdays'] unless !hash.key?('weekdays') @holidays = ::LibTAD::DateCalculator::BusinessHoliday.new hash['holidays'] unless !hash.key?('holidays') end |
Instance Attribute Details
#calendardays ⇒ Integer (readonly)
Number of calendar days in calculated period.
11 12 13 |
# File 'lib/types/date_calculator/period.rb', line 11 def calendardays @calendardays end |
#enddate ⇒ ::LibTAD::TADTime::TADTime (readonly)
The date the calculation ended on.
23 24 25 |
# File 'lib/types/date_calculator/period.rb', line 23 def enddate @enddate end |
#holidays ⇒ ::LibTAD::DateCalculator::BusinessHoliday (readonly)
Holidays which occur in the requested period.
31 32 33 |
# File 'lib/types/date_calculator/period.rb', line 31 def holidays @holidays end |
#includeddays ⇒ Integer (readonly)
Number of days calculated.
7 8 9 |
# File 'lib/types/date_calculator/period.rb', line 7 def includeddays @includeddays end |
#skippeddays ⇒ Integer (readonly)
Number of days which was skipped in the calculated period.
15 16 17 |
# File 'lib/types/date_calculator/period.rb', line 15 def skippeddays @skippeddays end |
#startdate ⇒ ::LibTAD::TADTime::TADTime (readonly)
The date the calculation started from.
19 20 21 |
# File 'lib/types/date_calculator/period.rb', line 19 def startdate @startdate end |
#weekdays ⇒ ::LibTAD::DateCalculator::Weekdays (readonly)
The spread of excluded or included weekdays in includeddays.
27 28 29 |
# File 'lib/types/date_calculator/period.rb', line 27 def weekdays @weekdays end |