Method: When::BasicTypes::Time._to_string_clock
- Defined in:
- lib/when_exe/basictypes.rb
._to_string_clock(clock) ⇒ Object
時間帯の表現を正規化する
404 405 406 407 408 409 410 411 412 |
# File 'lib/when_exe/basictypes.rb', line 404 def _to_string_clock(clock) return nil unless clock return clock if (clock =~ /\A[A-Z]+(\?.+)?\z/) raise ArgumentError, "Wrong clock format: #{clock}" unless clock =~ /\A([-+])(\d{2})(?::?(\d{2}))?(?::?(\d{2}))?\z/ sgn, h, m, s = $~[1..4] zone = sgn + h + ':' + (m||'00') zone += s if s return zone end |