module OpenEHR::AssumedLibraryTypes::ISO8601DurationModule
Attributes
days[R]
fractional_second[R]
hours[R]
minutes[R]
months[R]
seconds[R]
weeks[R]
years[R]
Public Instance Methods
as_string()
click to toggle source
# 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
days=(days)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 608 def days=(days) unless days.nil? || days >= 0 raise ArgumentError, 'days must be above zero' end @days = days end
fractional_second=(fractional_second)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 636 def fractional_second=(fractional_second) unless fractional_second.nil? || (fractional_second >= 0 && fractional_second < 1.0) raise ArgumentError, 'fractional_second must be between 0.0 and 1.0' end @fractional_second = fractional_second end
hours=(hours)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 615 def hours=(hours) unless hours.nil? || hours >= 0 raise ArgumentError, 'hours must be above zero' end @hours = hours end
minutes=(minutes)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 622 def minutes=(minutes) unless minutes.nil? || minutes >= 0 raise ArgumentError, 'minutes must be above zero' end @minutes = minutes end
months=(months)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 594 def months=(months) unless months.nil? || months >= 0 raise ArgumentError, 'months must be above zero' end @months = months end
seconds=(seconds)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 629 def seconds=(seconds) unless seconds.nil? || seconds >= 0 raise ArgumentError, 'seconds must be above zero' end @seconds = seconds end
weeks=(weeks)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 601 def weeks=(weeks) unless weeks.nil? || weeks >= 0 raise ArgumentError, 'weeks must be above zero' end @weeks = weeks end
years=(years)
click to toggle source
# File lib/open_ehr/assumed_library_types.rb, line 587 def years=(years) unless years.nil? || years >= 0 raise ArgumentError, 'years must be above zero' end @years = years end