class OpenEHR::AssumedLibraryTypes::ISO8601Date
Public Class Methods
new(string)
click to toggle source
# File lib/openehr/assumed_library_types.rb, line 261 def initialize(string) /(\d{4})(?:-(\d{2})(?:-(\d{2})?)?)?/ =~ string if $1.nil? raise ArgumentError, 'data invalid' else self.year = $1.to_i end if $2.nil? self.month = nil else self.month = $2.to_i end if $3.nil? self.day = nil else self.day = $3.to_i end end
valid_iso8601_date?(string)
click to toggle source
# File lib/openehr/assumed_library_types.rb, line 284 def self.valid_iso8601_date?(string) begin Date.parse(string) rescue return false end true end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/openehr/assumed_library_types.rb, line 280 def <=>(other) self.to_days <=> other.to_days end