Module: When::TimeStandard::TimeBasis

Included in:
When::TM::Calendar
Defined in:
lib/when_exe/timestandard.rb

Overview

When::TM::Calendar のための TimeBasis の初期化

Defined Under Namespace

Modules: ApparentTimeBasis, FixedTimeBasis

Instance Method Summary collapse

Instance Method Details

#_normalize_time_basisObject

When::TM::Calendar のための TimeBasis の初期化


366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/when_exe/timestandard.rb', line 366

def _normalize_time_basis

  @_time_basis ||= @time_basis || (@location ? @location.long / When::Coordinates::Spatial::DEGREE * 240 : When.utc)
  @_time_basis   = When::Parts::Locale._split(@_time_basis) if @_time_basis.kind_of?(String)
  @_time_basis   = [@_time_basis] unless @_time_basis.kind_of?(Array)
  @_time_basis   = @_time_basis.map {|clock| When.Clock(clock)}
  @_time_basis_offset = @_time_basis.map {|clock| -clock.universal_time / When::TM::Duration::DAY}

  @time_basis = @_time_basis[0] if @time_basis

  if @_time_basis[0].time_standard.kind_of?(LocalApparentTime)
    class << self; include ApparentTimeBasis ; end
  else
    class << self; include FixedTimeBasis    ; end
  end
end