class OpenEHR::AssumedLibraryTypes::ISO8601Duration
Public Class Methods
new(str)
click to toggle source
# File lib/openehr/assumed_library_types.rb, line 693 def initialize(str) /^P((\d+)[Yy])?((\d+)[Mm])?((\d+)[Ww])?((\d)[dD])?(T((\d+)[Hh])?((\d+)[Mm])?((\d+)(\.\d+)?[Ss])?)?$/ =~ str self.years = $2.to_i self.months = $4.to_i self.weeks = $6.to_i self.days = $8.to_i self.hours = $11.to_i self.minutes = $13.to_i self.seconds = $15.to_i unless $16.nil? self.fractional_second = $16.to_f end end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/openehr/assumed_library_types.rb, line 707 def <=>(other) self.to_seconds <=> other.to_seconds end