Method: When::TM::CalDate#_event_form

Defined in:
lib/when_exe/inspect.rb

#_event_form(other = nil, options = {}) ⇒ String

Note:

events 配列なし - 日時をそのまま文字列化日時の精度が日より細かい - イベント名(イベント時刻) 日時の精度が日 - イベント名(当日までの経過日数)

event を 文字列化 - 日時で与えられた event を文字列化する

Parameters:

  • other (When::TM::TemporalPosition) (defaults to: nil)

    時系の歩度を比較する基準(nilは比較しない)

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

    下記の通り

Options Hash (options):

  • :precision (Numeric)

    イベント名(イベント)出力の場合の時刻の丸め位置(nilなら丸めない)

  • :method (Symbol)

    変換に用いるメソッド(:to_m17n のとき多言語文字列化)

Returns:



1322
1323
1324
1325
1326
1327
1328
1329
1330
# File 'lib/when_exe/inspect.rb', line 1322

def _event_form(other=nil, options={})
  return options[:method]==:to_m17n ? to_m17n : self unless events
  return events[0] + '(' + _clk_time_for_inspect(options[:precision]).
    to_s(options[:precision] || precision)[/[:*=0-9]+/] + ')' if precision > When::DAY
  return events[0] unless other
  other = JulianDate.dynamical_time(other.dynamical_time,
            {:time_standard=>time_standard}) unless time_standard.rate_of_clock == other.time_standard.rate_of_clock
  events[0] + '('  + (other.to_i - to_i).to_s + ')'
end