Class: When::CalendarTypes::CalendarNote::JapaneseLuniSolarNote

Inherits:
When::CalendarTypes::CalendarNote show all
Defined in:
lib/when_exe/region/japanese_notes.rb

Overview

太陰太陽暦の暦注

Constant Summary collapse

StarMansions =

変換表 月日→27宿

[                                 #              正  2  3  4  5  6  7  8  9  10  11  12  
  [11, 13, 15, 17, 19, 21, 24,  0,  2,  4,  7,  9], # 0 : 本月本説 室12奎14胃16畢18參20鬼22張25角00氐02心04斗07虛10
  [ 5,  3,  1, 25, 23, 21, 19, 16, 14, 11,  8,  7], # 1 : 本月異説 尾05房03亢01翼26星24鬼22參20昴17婁15室12女09斗07
  [14, 16, 18, 20, 22, 24,  0,  3,  5,  7, 10, 12], # 2 : 閏月本説 婁15昴17觜19井21柳23張25角00房03尾05斗07危11壁13
  [12, 14, 16, 18, 19, 21, 24,  0,  2,  5,  8, 10], # 3 : 閏月異説 壁13婁15昴17觜19參20鬼22張25角00氐02尾05女09危11
  [14, 16, 18, 23, 22, 24,  0,  3,  5,  7,  8, 12]  # 4 : 閏月本説(元)        (星24)                      (女09)
]
StarMansionIndex =

変換表 27宿→28宿

(0..7).to_a + (9..27).to_a
WeekDepended =

七曜と27宿で決まる暦注

{
             # 日  月  火  水  木  金  土
  '甘露'   => [26, 17,  5, 22, 21,  3, 23],  # 軫27 畢18 尾05 柳23 鬼22 房03 星24
  '金剛峯' => [ 5,  8, 12, 16, 20, 24,  1],  # 尾05 女09 壁13 昴17 井21 張25 亢01
  '羅刹'   => [15, 21, 25, 19,  2, 13, 22]   # 胃16 鬼22 翼26 参20 氐02 奎14 柳23
}
HumanBody =

人神配当

%w(足大指 外踝 股内 腰   口     手     内踝   腕   尻 腰背
鼻柱   髪際 牙歯 胃管 遍身   胸     気街   股内 足 踝
足小指 足踝及胸、目下 肝及足 手陽明 足陽明 胸   膝 陰   膝晊 足跌)
Rokuyo =

六曜

When.Resource('_m:JapaneseTerms::六曜')

Constants inherited from When::CalendarTypes::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from When::CalendarTypes::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Class Method Summary collapse

Methods inherited from When::CalendarTypes::CalendarNote

#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

Methods included from Parts::Resource::Pool

#[], #[]=, #_pool, #_setup_, #pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Class Method Details

._day_notes(notes, dates, conditions = {}) ⇒ Object

日の暦注


875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
# File 'lib/when_exe/region/japanese_notes.rb', line 875

def self._day_notes(notes, dates, conditions={})

  # 廿七宿
  m, l = [1,0].map {|f| dates.m_date.cal_date[1] * f}
  d    = (StarMansions[l==1 ? (conditions[:i27]||0) :
                              (conditions[:n27]||0)][m-1] + dates.m_date.cal_date[2] - 1) % 27
  notes['廿七宿'] ||= StarMansionIndex[d]

  # 甘露 / 金剛峯 / 羅刹
  w    = (dates.m_date.to_i + 1) % 7
  ['甘露', '金剛峯', '羅刹'].each do |c|
    notes[c] = c if d == WeekDepended[c][w]
  end

  # 三寶吉・神吉・雑事吉
  notes['神吉']   = notes['雑事吉'] = notes['三寶吉'] = nil if notes['没'  ] || notes['滅'  ]
  notes['神吉']   = notes['雑事吉']                   = nil if notes['日食'] || notes['月食'] || notes['往亡']
  notes['三寶吉'] = nil if !notes['甘露'] && (notes['羅刹'] || notes['日食'] || notes['月食'])
  notes['三寶吉'] = notes['甘露'] ? '三寶吉' : nil if /\+/ =~ notes['三寶吉'].to_s
  notes['三寶吉'] = '三吉' if notes['三寶吉'] && dates.range >= 8 # 鎌倉以降

  # 除手足甲 & 道虚・人神配当
  y,m0,d0 = dates.m_date.cal_date
  misoka  = m0 != (dates.m_date + When.Duration('P1D')).cal_date[1] if d0 == 29
  notes['除手足甲'] = '除手足甲' if ([6,16,30].include?(d0) || misoka) && !(notes['没'] || notes['滅'] || notes['凶会'])
  notes['道虚']     = '道虚'     if d0 % 6 == 0 || misoka
  notes['人神配当'] = HumanBody[d0-1]

  # 仮名暦
  notes['赤舌'  ] ||= d0 == (m * 5 - 3) % 6 + 1 ? '赤舌' : nil
  notes['大赤'  ] ||= d0 % 8 == (m * 7 - 3) % 8 ? '大赤' : nil
  notes['不成就'] ||= d0 % 8 == [6,3,2,1,4,5][m % 6] || (misoka && m % 6 == 0) ? '不成就' : nil # 『現代こよみ読み解き事典』 for 不成就日
  notes['六曜'  ] ||= Rokuyo[(m + d0) % 6]
  notes
end

._month_notes(notes, dates, conditions = {}) ⇒ Object

月の暦注


868
869
870
871
# File 'lib/when_exe/region/japanese_notes.rb', line 868

def self._month_notes(notes, dates, conditions={})
  # 月名
  notes['月名'] ||= dates.o_date.name('month')
end