class LibTAD::DateCalculator::Period

Calculated results for a requested period.

Attributes

calendardays[R]

@return [Integer] Number of calendar days in calculated period.

enddate[R]

@return [::LibTAD::TADTime::TADTime] The date the calculation ended on.

holidays[R]

@return [::LibTAD::DateCalculator::BusinessHoliday] Holidays which occur in the requested period.

includeddays[R]

@return [Integer] Number of days calculated.

skippeddays[R]

@return [Integer] Number of days which was skipped in the calculated period.

startdate[R]

@return [::LibTAD::TADTime::TADTime] The date the calculation started from.

weekdays[R]

@return [::LibTAD::DateCalculator::Weekdays] The spread of excluded or included weekdays in includeddays.

Public Class Methods

new(hash) click to toggle source
# 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