Class: When::Coordinates::Branch
- Inherits:
-
Residue
- Object
- BasicTypes::Object
- Residue
- When::Coordinates::Branch
- Defined in:
- lib/when_exe/region/residue.rb,
lib/when_exe/region/japanese/residues.rb
Overview
十二支
Constant Summary collapse
- Rules =
{ '大將軍' => %w(酉 酉 子 子 子 卯 卯 卯 午 午 午 酉), '大陰' => %w(戌 亥 子 丑 寅 卯 辰 巳 午 未 申 酉), '歳刑' => %w(卯 戌 巳 子 辰 申 午 丑 寅 酉 未 亥), '破' => %w(午 未 申 酉 戌 亥 子 丑 寅 卯 辰 巳), '煞' => %w(未 辰 丑 戌), '黄幡' => %w(辰 丑 戌 未 辰 丑 戌 未 辰 丑 戌 未), '豹尾' => %w(戌 未 辰 丑 戌 未 辰 丑 戌 未 辰 丑), '歳次' => %w(玄枵 星紀 析木 大火 壽星 鶉尾 鶉火 鶉首 實沈 大梁 降婁 娵訾), '天氣' => %w(東南 西 南 西南 北 西 西北 東 北 東北 南 東), '天道' => %w(艮坤 甲庚 乙辛 巽乾 丙壬 丁癸), '人道' => %w(巽乾 丙壬 丁癸 艮坤 甲庚 乙辛), '天徳' => %w(巽 庚 丁 坤 壬 辛 乾 甲 癸 艮 丙 乙), '用時' => %w(艮巽坤乾 乙丁辛亥 甲丙庚壬), '月徳' => %w(壬 庚 丙 甲), '月徳合' => %w(丁 乙 辛 己), '月空' => %w(丙 甲 壬 庚), '三鏡' => %w(甲丙庚壬坤乾 甲乙丁庚辛癸 乙辛乾坤巽艮 甲丙庚壬乾巽 乙丙丁辛壬癸 丁癸乾坤巽艮 甲丙庚壬坤艮 甲乙丁庚辛癸 乙辛乾艮巽坤 甲丙庚壬乾巽 乙丙丁辛壬癸 丁癸坤乾艮巽), '土府' => %w(申 子 丑 巳 酉 寅 午 戌 卯 未 亥 辰), '土公' => %w(庭 庭 竈 竈 竈 門 門 門 井 井 井 庭), '十二直' => %w(建 除 滿 平 定 執 破 危 成 收 開 閉), '三禍' => %w(子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥), '下食時' => %w(亥+ 子+ 丑+ 寅+ 卯 辰 巳 午 未 申 酉+ 戌+) }
Constants inherited from Residue
Constants included from Parts::Resource
Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty
Instance Attribute Summary
Attributes inherited from Residue
#carry, #divisor, #remainder, #units
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#_day_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
日の十二支で決まる暦注.
-
#_month_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
月の十二支で決まる暦注.
-
#_year_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
年の十二支で決まる暦注.
Methods inherited from Residue
#%, #&, #+, #-, #<<, #>>, #[], _china, #_column_for_week_included, _day_of_week, #_enumerator, #_range_for_week_included, day_of_week, #difference, #duration, #event, #initialize, mod, #to, #to_m17n, #to_s
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, #next, #parent, #prev, #registered?, root_dir
Methods included from Parts::Resource::Pool
#[], #[]=, #_pool, #_setup_, #pool_keys
Methods included from Parts::Resource::Synchronize
Constructor Details
This class inherits a constructor from When::Coordinates::Residue
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Coordinates::Residue
Instance Method Details
#_day_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
日の十二支で決まる暦注
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/when_exe/region/japanese/residues.rb', line 204 def _day_notes(notes={}, dates=nil, conditions={}) # 節月 month = dates.s_date.cal_date[1] born = Rules['三禍'][month-1] + '年' # 具注暦(元嘉暦以来) notes['十二直'] ||= Rules['十二直'][(@remainder-month-1) % 12] notes['歸忌' ] ||= @remainder == (month % 3) ? '歸忌' : nil notes['血忌' ] ||= @remainder == [1,7,2,8,3,9,4,10,5,11,6,0][month-1] ? '血忌' : nil unless notes['九坎'] && notes['小字注'] notes['九坎' ] = @remainder == [4,1,10,7,3,0,9,6,2,11,8,5][month-1] ? '九坎' : nil end notes['厭' ] ||= @remainder == (17-month) % 12 ? '厭對' : nil notes['厭' ] ||= @remainder == (11-month) % 12 ? '厭' : nil notes['天倉' ] ||= @remainder == (3-month) % 12 ? '天倉' : nil # 具注暦(大衍暦以来) notes['忌遠行'] ||= @remainder == [1,9,5][month % 3] ? '忌遠行' : nil notes['忌夜行'] ||= @remainder == [0,6,5,10,7,4][(month-1) / 2] ? '忌夜行' : nil notes['大禍' ] ||= @remainder == (month * 7 + 4) % 12 ? born + '大禍' : nil notes['狼藉' ] ||= @remainder == (conditions[:kana] ? ((month-1) % 4) * 3 : # - wikipedia 「天火」におなじ [0,3,6,6,0,3,9,9,3,3,6,9][month-1]) ? born + '狼藉' : nil # %w(...酉..午.子...) notes['滅門' ] ||= @remainder == (month * 7 + 10) % 12 ? born + '滅門' : nil notes['下食時'] ||= @remainder == [7,10,4,2,6,0,8,9,5,11,1,3][month-1] ? Rules['下食時'][month-1] : nil notes['下食時'] = dates.range < 11 ? notes['下食時' ].sub(/\+/, '') : nil if /\+/ =~ notes['下食時'].to_s # '+' は貞享改暦以降記さない notes['無翹' ] ||= @remainder == (12-month) % 12 ? '無翹' : nil notes['不弔人'] ||= [4,6].include?(@remainder) ? '不弔人' : nil # 不断 notes['重' ] ||= @remainder % 6 == 5 ? '重' : nil # 不断 unless notes['凶会'] || notes['没'] || notes['滅'] notes['沐浴'] ||= [0,8,9,11].include?(@remainder) ? '沐浴' : nil end notes['月煞' ] ||= @remainder == [4,1,10,7][month % 4] ? '月煞' : nil # 仮名暦 notes['初午'] ||= @remainder == 6 && dates.o_date.cal_date[1] == 2 && (1..12).include?(dates.o_date.cal_date[2]) ? '初午' : nil notes['天火' ] ||= @remainder == ((month-1) % 4) * 3 ? '天火' : nil notes['地火' ] ||= @remainder == (month + 4) % 12 ? '地火' : nil notes['人火' ] ||= @remainder == [12,0,8,10,12,3,7,6,12,6,9,9][month-1] ? '人火' : nil notes['雷火' ] ||= @remainder == [12,7,7,5,12,6,6,5,12,11,7,6][month-1] ? '雷火' : nil notes['一粒万倍'] ||= [[1,6],[2,9],[0,3],[3,4 ],[5,6 ],[6,9], [0,7],[3,8],[6,9],[9,10],[0,11],[0,3]][month-1].include?(@remainder) ? '一粒万倍' : nil notes['金神間日'] ||= @remainder == [1,8,7,9][(month-1) / 3] ? '金神間日' : nil notes['十死' ] ||= @remainder == [1,9,5][month % 3] ? '十死' : nil notes['受死' ] ||= @remainder == [10,4,11,5,0,6,1,7,2,8,3,9][month-1] ? '受死' : nil notes['天福' ] ||= @remainder == [5,2,11,8][month % 4] ? '天福' : nil notes['地福' ] ||= @remainder == [11,8,5,2][month % 4] ? '地福' : nil notes['地五福' ] ||= @remainder == [8,11,2,5][month % 4] ? '地五福' : nil notes['三隣亡' ] ||= @remainder == [6,11,2][month % 3] ? '三隣亡' : nil notes['金性'] ||= @remainder == 3 && month == 2 && dates.s_date.cal_date[0] % 12 == 7 && (1..12).include?(dates.s_date.cal_date[2]) ? '金性' : nil notes end |
#_month_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
月の十二支で決まる暦注
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/when_exe/region/japanese/residues.rb', line 180 def _month_notes(notes={}, dates=nil, conditions={}) if dates.range < 2 notes['天氣'] ||= Rules['天氣' ][@remainder] + '行' notes['天道'] ||= Rules['天道' ][@remainder % 6] notes['人道'] ||= Rules['人道' ][@remainder % 6] notes['月破'] ||= Rules['破' ][@remainder] else notes['天道'] ||= Rules['天氣' ][@remainder] + '行' end notes['天徳' ] ||= Rules['天徳' ][@remainder] notes['月煞' ] ||= Rules['煞' ][@remainder % 4] notes['用時' ] ||= Rules['用時' ][@remainder % 3] notes['月徳' ] ||= Rules['月徳' ][@remainder % 4] notes['月徳合'] ||= Rules['月徳合'][@remainder % 4] notes['月空' ] ||= Rules['月空' ][@remainder % 4] notes['三鏡' ] ||= Rules['三鏡' ][@remainder] notes['土府' ] ||= Rules['土府' ][@remainder] notes['土公' ] ||= Rules['土公' ][@remainder] notes end |
#_year_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
年の十二支で決まる暦注
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/when_exe/region/japanese/residues.rb', line 160 def _year_notes(notes={}, dates=nil, conditions={}) notes['大將軍'] ||= Rules['大將軍'][@remainder] notes['大陰' ] ||= Rules['大陰' ][@remainder] notes['歳刑' ] ||= Rules['歳刑' ][@remainder] notes['歳破' ] ||= Rules['破' ][@remainder] notes['歳煞' ] ||= Rules['煞' ][@remainder % 4] notes['黄幡' ] ||= Rules['黄幡' ][@remainder] notes['豹尾' ] ||= Rules['豹尾' ][@remainder] if dates.range < 2 notes['天道'] ||= Rules['天道' ][@remainder % 6] notes['人道'] ||= Rules['人道' ][@remainder % 6] else notes['歳次'] ||= Rules['歳次' ][@remainder] end notes end |