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.



375
376
377
# File 'lib/when_exe/region/japanese/notes.rb', line 375

def calendar
  @calendar
end

#solarObject (readonly)

Returns the value of attribute solar.



375
376
377
# File 'lib/when_exe/region/japanese/notes.rb', line 375

def solar
  @solar
end

Instance Method Details

#doyoObject



398
399
400
# File 'lib/when_exe/region/japanese/notes.rb', line 398

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

#l_calendarObject



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

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

#l_phasesObject



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

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

#s_calendarObject



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

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

#s_termsObject



389
390
391
# File 'lib/when_exe/region/japanese/notes.rb', line 389

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

#s_terms2Object



393
394
395
396
# File 'lib/when_exe/region/japanese/notes.rb', line 393

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