Class: When::BasicTypes::DateTime
- Defined in:
- lib/when_exe/basictypes.rb
Overview
ISO 8601 Date and Time Representation
see xml schema
Class Method Summary collapse
-
._to_array(date_time, options = {}) ⇒ Array
When.exe Standard Representation 形式の表現を分解してArray化する.
Methods inherited from String
#^, #calendar, #calendar_era, #calendar_note, #clock, #encode, #era, #ideographic_unification, #m17n, #ord, #resource, #to_m17n, #to_month_name, #to_pair, #to_r, #to_residue, #translate, #when?
Methods included from EncodingConversion
#+@, #-@, #to_external_encoding, #to_internal_encoding
Class Method Details
._to_array(date_time, options = {}) ⇒ Array
When.exe Standard Representation 形式の表現を分解してArray化する
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/when_exe/basictypes.rb', line 48 def _to_array(date_time, ={}) raise TypeError, "Argument is not ISO 8601 String" unless date_time.kind_of?(String) if [:abbr].kind_of?(When::TimeValue) [:abbr] = (([:frame]||When::Gregorian) ^ [:abbr]).cal_date end date_time = date_time.gsub(/[_\s]+([\d])/, '\1') begin return _to_array_basic(date_time, ) rescue ArgumentError return _to_array_extended(date_time, ) end end |