Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/when_exe/core/duration.rb,
lib/when_exe/core/extension.rb

Overview

Extensions to Array class

Instance Method Summary collapse

Instance Method Details

#durationWhen::TM::Duration Also known as: to_duration

Note:

core/duration

self を Array<日, 時, 分, 秒> とみなして When::TM::Duration を生成

Returns:


106
107
108
# File 'lib/when_exe/core/duration.rb', line 106

def duration
  When::TM::Duration.dhms(*self)
end

#tm_position(options = {}) ⇒ When::TM::TemporalPosition Also known as: to_tm_position

Note:

core/extension

self を暦要素の Array とみなして [When::TM::TemporalPosition] を生成

Parameters:

  • options (Hash) (defaults to: {})

    暦法や時法などの指定 @option options [Symbol] :invalid

    [:raise     日時が存在しない場合例外発生              ]
    [:check     日時が存在しない場合 nil を返す           ]
    [その他/nil 日時が存在することを確認しない(デフォルト)]
    

    see also When::TM::TemporalPosition._instance

Returns:

Raises:

  • (ArgumentError)

    options[ :invalid ] が :raise で、日時が存在しない場合


420
421
422
# File 'lib/when_exe/core/extension.rb', line 420

def tm_position(options={})
  When.TemporalPosition(*(self.dup << options))
end

#to_pairWhen::Coordinates::Pair Also known as: pair

self と解釈してWhen::Coordinates::Pair を生成


431
432
433
# File 'lib/when_exe/core/extension.rb', line 431

def to_pair
  Coordinates::Pair._force_pair(*self)
end