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 Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_time_basisObject (readonly)



323
324
325
# File 'lib/when_exe/timestandard.rb', line 323

def _time_basis
  @_time_basis
end

Instance Method Details

#_normalize_time_basisObject

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



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/when_exe/timestandard.rb', line 378

def _normalize_time_basis

  @_time_basis ||= @time_basis || (@location ? @location.long / When::Coordinates::Spatial::DEGREE * 240 : When::UTC)
  @_time_basis   = When::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)
    extend ApparentTimeBasis
  else
    extend FixedTimeBasis
  end
end