Module: OpenEHR::AssumedLibraryTypes::ISO8601DurationModule

Includes:
TimeDefinitions
Included in:
ISO8601Duration, RM::DataTypes::Quantity::DateTime::DvDuration
Defined in:
lib/open_ehr/assumed_library_types.rb

Overview

end of ISO8601Timezone

Constant Summary

Constants included from TimeDefinitions

TimeDefinitions::DAYS_IN_LEAP_YEAR, TimeDefinitions::DAYS_IN_WEEK, TimeDefinitions::DAYS_IN_YEAR, TimeDefinitions::HOURS_IN_DAY, TimeDefinitions::MAX_DAYS_IN_MONTH, TimeDefinitions::MAX_DAYS_IN_YEAR, TimeDefinitions::MINUTES_IN_HOUR, TimeDefinitions::MONTH_IN_YEAR, TimeDefinitions::NOMINAL_DAYS_IN_MONTH, TimeDefinitions::NOMINAL_DAYS_IN_YEAR, TimeDefinitions::SECONDS_IN_MINUTE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TimeDefinitions

valid_day?, valid_hour?, valid_minute?, valid_month?, valid_second?, valid_year?

Instance Attribute Details

#daysObject

Returns the value of attribute days.



584
585
586
# File 'lib/open_ehr/assumed_library_types.rb', line 584

def days
  @days
end

#fractional_secondObject

Returns the value of attribute fractional_second.



585
586
587
# File 'lib/open_ehr/assumed_library_types.rb', line 585

def fractional_second
  @fractional_second
end

#hoursObject

Returns the value of attribute hours.



585
586
587
# File 'lib/open_ehr/assumed_library_types.rb', line 585

def hours
  @hours
end

#minutesObject

Returns the value of attribute minutes.



585
586
587
# File 'lib/open_ehr/assumed_library_types.rb', line 585

def minutes
  @minutes
end

#monthsObject

Returns the value of attribute months.



584
585
586
# File 'lib/open_ehr/assumed_library_types.rb', line 584

def months
  @months
end

#secondsObject

Returns the value of attribute seconds.



585
586
587
# File 'lib/open_ehr/assumed_library_types.rb', line 585

def seconds
  @seconds
end

#weeksObject

Returns the value of attribute weeks.



584
585
586
# File 'lib/open_ehr/assumed_library_types.rb', line 584

def weeks
  @weeks
end

#yearsObject

Returns the value of attribute years.



584
585
586
# File 'lib/open_ehr/assumed_library_types.rb', line 584

def years
  @years
end

Instance Method Details

#as_stringObject



643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/open_ehr/assumed_library_types.rb', line 643

def as_string
  str = 'P'
  unless @years.nil?
    str += @years.to_s + 'Y'
  end
  unless @months.nil?
    str += @months.to_s + 'M'
  end
  unless @weeks.nil?
    str += @weeks.to_s + 'W'
  end
  unless @days.nil?
    str += @days.to_s + 'D'
  end
  unless @hours.nil?
    str += 'T' + @hours.to_s + 'H'
    unless @minutes.nil?
      str += @minutes.to_s + 'M'
      unless @seconds.nil?
        str += @seconds.to_s
        unless @fractional_second.nil?
          str += @fractional_second.to_s[1 .. -1]
        end
        str += 'S'
      end
    end
  end
  return str
end