Method: When::BasicTypes::Time._to_array_basic
- Defined in:
- lib/when_exe/basictypes.rb
._to_array_basic(time, t, options = {}) ⇒ Object
基本形式の表現を分解して配列化する
360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
# File 'lib/when_exe/basictypes.rb', line 360 def _to_array_basic(time, t, ={}) return nil unless t return [0] unless time time.sub!(/,/, '.') unless (time =~ /\A(\d{2}(?:\.\d+)?|-)(\d{2}(?:\.\d+)?|-)?(\d{2}(\.\d+)?)?\z/) raise ArgumentError, "Wrong time format: #{time}" end indices = [:frame] ? When.Calendar([:frame]).indices : Coordinates::DefaultDateIndices abbr = Array([:abbr]).dup abbr[0..indices.length] = [] return [0, Coordinates::Pair._en_number($1=='-' ? abbr[0] : $1, nil), Coordinates::Pair._en_number($2=='-' ? abbr[1] : $2, nil), Coordinates::Pair._en_number($3, nil)] end |