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:



143
144
145
# File 'lib/when_exe/core/duration.rb', line 143

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

#tm_pos(options = {}) ⇒ When::TM::TemporalPosition Also known as: to_tm_pos

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 で、日時が存在しない場合



464
465
466
# File 'lib/when_exe/core/extension.rb', line 464

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

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

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



475
476
477
# File 'lib/when_exe/core/extension.rb', line 475

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