Method: When::BasicTypes::Time._to_array_extended
- Defined in:
- lib/when_exe/basictypes.rb
._to_array_extended(time, t, options = {}) ⇒ Object
拡張形式の表現を分解して配列化する
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/when_exe/basictypes.rb', line 376 def _to_array_extended(time, t, ={}) return nil unless t return [0] unless time indices = [:frame] ? When.Calendar([:frame]).indices : Coordinates::DefaultDateIndices abbr = Array([:abbr]).dup abbr[0..indices.length] = [] time.sub!(/,/, '.') if time =~ /\A([:*=])(.+)/ time = $2 tt = [Coordinates::Pair._en_pair(0, $1)] else tt = [0] end while time =~ /\A(\d{1,2}(?:\.\d+)?|-)([:*=])(.+)/ time = $3 tt << Coordinates::Pair._en_pair($1=='-' ? abbr.shift : $1, $2) end case time when /\A(\d{1,2}(\.\d+)?)\z/ tt << Coordinates::Pair._en_number($1, nil) when '' else raise ArgumentError, "Wrong time format: #{time}" end return tt end |