Class: When::CalendarNote::JapaneseLuniSolarNote

Inherits:
When::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(足大指 外踝 股内              内踝       腰背
鼻柱   髪際 牙歯 胃管 遍身        気街   股内  
足小指 足踝及胸、目下 肝及足 手陽明 足陽明        膝晊 足跌)

Constants inherited from When::CalendarNote

Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, HashProperty, Javanese, JulianDay, Mayan, Tibetan, Yis

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Constants included from Namespace

Namespace::DC, Namespace::DCQ, Namespace::DCT, Namespace::FOAF, Namespace::OWL, Namespace::RDF, Namespace::RDFC, Namespace::RDFS, Namespace::RSS, Namespace::XSD

Instance Attribute Summary

Attributes inherited from When::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::CalendarNote

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

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _abbreviation_to_iri, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir

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

日の暦注



959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/when_exe/region/japanese/notes.rb', line 959

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['三寶吉'] = notes['小字注'] = nil if notes[''] || notes['']
  notes['神吉']   = notes['雑事吉'] = nil if notes['往亡']
  notes['神吉']   = notes['三寶吉'] = nil if notes['月食']
  notes['小字注'] = nil  if notes['日食'] || notes['月食']
  notes['小字注'] = nil  if notes['九坎'] && dates.range==5 # 11世紀後半
  notes['三寶吉'] = nil  if 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) && !(conditions[:kana] || 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] ? '不成就' : nil # 『現代こよみ読み解き事典』 for 不成就日(ただし6・12月晦日は無効化)
  notes['六曜'  ] ||= When::RokuyoWeek.rokuyo_value(m, d0)
  notes
end

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

月の暦注



952
953
954
955
# File 'lib/when_exe/region/japanese/notes.rb', line 952

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