Class: When::CalendarNote::Japanese::Cal4Note

Inherits:
Object
  • Object
show all
Defined in:
lib/when_exe/region/japanese/notes.rb,
lib/when_exe/region/japanese/notes.rb

Overview

日本暦注が使用する暦法

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calendar, solar) ⇒ Cal4Note

Returns a new instance of Cal4Note.



25
26
27
28
# File 'lib/when_exe/region/japanese/notes.rb', line 25

def initialize(calendar, solar)
  @calendar = calendar
  @solar    = solar
end

Instance Attribute Details

#calendarObject (readonly)

Returns the value of attribute calendar.



363
364
365
# File 'lib/when_exe/region/japanese/notes.rb', line 363

def calendar
  @calendar
end

#solarObject (readonly)

Returns the value of attribute solar.



363
364
365
# File 'lib/when_exe/region/japanese/notes.rb', line 363

def solar
  @solar
end

Instance Method Details

#doyoObject



386
387
388
# File 'lib/when_exe/region/japanese/notes.rb', line 386

def doyo
  @doyo       ||= (s_calendar.doyo ? s_calendar.doyo * 360.0 / s_calendar.formula[0].year_length : 0)
end

#l_calendarObject



365
366
367
# File 'lib/when_exe/region/japanese/notes.rb', line 365

def l_calendar
  @l_calendar ||= When.Calendar(@calendar.kind_of?(String) ? @calendar.sub(/#\{\?.+?\}/, '') : @calendar)
end

#l_phasesObject



373
374
375
# File 'lib/when_exe/region/japanese/notes.rb', line 373

def l_phases
  @l_phases   ||= Japanese::LunarPhases.new('formula'=>l_calendar.formula[-1])
end

#s_calendarObject



369
370
371
# File 'lib/when_exe/region/japanese/notes.rb', line 369

def s_calendar
  @s_calendar ||= When.Calendar(@solar.kind_of?(String) ? @solar.sub(/#\{\?.+?\}/, '?Clock=THS') : @solar)
end

#s_termsObject



377
378
379
# File 'lib/when_exe/region/japanese/notes.rb', line 377

def s_terms
  @s_terms    ||= Japanese::SolarTerms.new('formula'=>s_calendar.formula[0])
end

#s_terms2Object



381
382
383
384
# File 'lib/when_exe/region/japanese/notes.rb', line 381

def s_terms2
  @s_terms2   ||= @l_calendar.iri =~ /JapaneseTwin(.*?)::天保暦/ ?
    Japanese::SolarTermsRevised.new('formula'=>s_calendar.formula[0]) : s_terms
end