Changeset 287 for ruby/branches/0.5
- Timestamp:
- Sep 23, 2009, 3:45:32 PM (15 years ago)
- Location:
- ruby/branches/0.5
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5/lib/open_ehr/assumed_library_types.rb
r285 r287 339 339 340 340 def self.valid_iso8601_time?(s) 341 if /^(\d{2}):?(\d{2})?(:?)(\d{2})?((\.|,)(\d+))?( T?)(Z|([+-](\d{2}):?(\d{2})))?$/ =~ s341 if /^(\d{2}):?(\d{2})?(:?)(\d{2})?((\.|,)(\d+))?(Z|([+-](\d{2}):?(\d{2})))?$/ =~ s 342 342 # ISO 8601 regular expression by H. Yuki 343 343 # http://digit.que.ne.jp/work/wiki.cgi?Perl%E3%83%A1%E3%83%A2%2FW3C%E5%BD%A2%E5%BC%8F%E3%81%AE%E6%97%A5%E6%99%82%E3%81%AE%E8%A7%A3%E6%9E%90 344 344 # (\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d))?)?(Z|([+-]\d{2}):(\d{2}))?)?)?)? 345 hh = $1; mm = $2; ss = $4; msec = $7; tz = $ 9345 hh = $1; mm = $2; ss = $4; msec = $7; tz = $8 346 346 if hh.to_i == HOURS_IN_DAY and (mm.nil? or mm.to_i == 0) and (ss.nil? or ss.to_i == 0) and (msec.nil? or msec.to_i==0) 347 347 return true … … 410 410 include ISO8601DateTimeModule 411 411 def initialize(string) 412 /(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|([+-]\d{2}):?(\d{2}))?)?)?)?/ =~ string 413 if $1.empty? 412 unless /(\d{4})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|([+-]\d{2}):?(\d{2}))?)?)?)?/ =~ string 414 413 raise ArgumentError, 'format invalid' 415 414 else
Note:
See TracChangeset
for help on using the changeset viewer.