Class: When::CalendarNote::Japanese::Dates
- Inherits:
-
Object
- Object
- When::CalendarNote::Japanese::Dates
- Defined in:
- lib/when_exe/region/japanese/notes.rb
Overview
日本暦注計算に必要となる暦日や暦法をまとめた内部クラス
Instance Attribute Summary collapse
-
#cal4note ⇒ Object
readonly
Returns the value of attribute cal4note.
-
#index_g ⇒ Object
readonly
Returns the value of attribute index_g.
-
#index_s ⇒ Object
readonly
Returns the value of attribute index_s.
-
#l_date ⇒ Object
readonly
Returns the value of attribute l_date.
-
#m_date ⇒ Object
readonly
Returns the value of attribute m_date.
-
#o_date ⇒ Object
readonly
Returns the value of attribute o_date.
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#s_date ⇒ Object
readonly
Returns the value of attribute s_date.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(date, year = date.most_significant_coordinate, precision = date.precision, cal4note = nil) ⇒ Dates
constructor
初期設定.
Constructor Details
#initialize(date, year = date.most_significant_coordinate, precision = date.precision, cal4note = nil) ⇒ Dates
初期設定
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/when_exe/region/japanese/notes.rb', line 429 def initialize(date, year=date.most_significant_coordinate, precision=date.precision, cal4note=nil) # 暦注パターン if cal4note # 年代による判定 (1...NoteRange.size).to_a.reverse.each do |i| if year >= NoteRange[i][0] @range = i break end end @range ||= 0 else # 暦法による判定 cal4note = Cal4Note.new(date.frame, date.frame.twin) @range = case cal4note.l_calendar.formula[-1] when When::Ephemeris::ChineseTrueLunation::JujiMethods ; 11 # 江戸時代の暦 when When::Ephemeris::ChineseTrueLunation date.frame.twin =~ /戊寅|麟徳/ ? 1 : 10 # 唐代定朔暦(儀鳳暦 or 宣明暦) when When::Ephemeris::MeanLunation ; 0 # 唐代以前平朔暦(元嘉暦) else ; 15 # 現代の旧暦 end end # 具注暦の配置 @index_g = NoteRange[@range][1] # 七十二候 @index_s = NoteRange[@range][2] # その他の属性 @year = year @precision = precision @cal4note = cal4note @o_date = date @l_date = @cal4note.l_calendar ^ date @m_date = date.frame.kind_of?(When::CalendarTypes::Christian) ? @l_date : @o_date @s_date = @cal4note.s_calendar ^ date end |
Instance Attribute Details
#cal4note ⇒ Object (readonly)
Returns the value of attribute cal4note.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def cal4note @cal4note end |
#index_g ⇒ Object (readonly)
Returns the value of attribute index_g.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def index_g @index_g end |
#index_s ⇒ Object (readonly)
Returns the value of attribute index_s.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def index_s @index_s end |
#l_date ⇒ Object (readonly)
Returns the value of attribute l_date.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def l_date @l_date end |
#m_date ⇒ Object (readonly)
Returns the value of attribute m_date.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def m_date @m_date end |
#o_date ⇒ Object (readonly)
Returns the value of attribute o_date.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def o_date @o_date end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def precision @precision end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def range @range end |
#s_date ⇒ Object (readonly)
Returns the value of attribute s_date.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def s_date @s_date end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
426 427 428 |
# File 'lib/when_exe/region/japanese/notes.rb', line 426 def year @year end |