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
- Notes =
{ '大将軍' => %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::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues
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, #_enumerator, #_to_hash_value, day_of_week, #difference, #duration, #event, #initialize, mod, #to, #to_m17n, #to_s
Methods inherited from BasicTypes::Object
Methods included from Parts::Resource
#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #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
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
日の十二支で決まる暦注
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 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 |
# File 'lib/when_exe/region/japanese_residues.rb', line 187 def _day_notes(notes={}, dates=nil, conditions={}) # 不断の暦注 # 具注暦 notes['不弔人'] ||= [4,6].include?(@remainder) ? '不弔人' : '' notes['重' ] ||= @remainder % 6 == 5 ? '重' : '' return notes unless dates # 節月に依存する暦注 month = dates.s_date.cal_date[1] born = Notes['三禍'][month-1] + '年' # 具注暦 notes['十二直'] ||= Notes['十二直'][(@remainder-month-1) % 12] 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 == (month * 3 - 3) % 12 ? 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] ? Notes['下食時'][month-1] : nil notes['下食時'] = dates.year < 1685 ? notes['下食時' ].sub(/\+/, '') : nil if /\+/ =~ notes['下食時'].to_s # '+' は貞享改暦以降記さない notes['帰忌' ] ||= @remainder == (month % 3) ? '帰忌' : nil notes['血忌' ] ||= @remainder == [1,7,2,8,3,9,4,10,5,11,6,0][month-1] ? '血忌' : nil notes['月煞' ] ||= @remainder == [4,1,10,7][month % 4] ? '月煞' : nil notes['九坎' ] ||= @remainder == [4,1,10,7,3,0,9,6,2,11,8,5][month-1] ? '九坎' : nil notes['厭' ] ||= @remainder == (17-month) % 12 ? '厭対' : nil notes['厭' ] ||= @remainder == (11-month) % 12 ? '厭' : nil notes['無翹' ] ||= @remainder == (12-month) % 12 ? '無翹' : 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 # 凶会日に省略される吉日 return notes if notes['凶会'] notes['母倉'] ||= [[0,11], [0,11], [5,6], [2,3], [2,3], [5,6], [1,4,7,10],[1,4,7,10],[5,6], [8,9], [8,9], [5,6]][month-1].include?(@remainder) ? '母倉' : nil # 没滅凶会日に省略される吉日 return notes if notes['没'] || notes['滅'] notes['沐浴'] ||= [0,8,9,11].include?(@remainder) ? '沐浴' : nil notes['除手足甲'] ||= {1=>'除手甲', 2=>'除足甲'}[@remainder] notes end |
#_month_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
月の十二支で決まる暦注
170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/when_exe/region/japanese_residues.rb', line 170 def _month_notes(notes={}, dates=nil, conditions={}) notes['天道' ] ||= Notes['天道' ][@remainder] notes['天徳' ] ||= Notes['天徳' ][@remainder] notes['月煞' ] ||= Notes['月煞' ][@remainder % 4] notes['用時' ] ||= Notes['用時' ][@remainder % 3] notes['月徳' ] ||= Notes['月徳' ][@remainder % 4] notes['月徳合'] ||= Notes['月徳合'][@remainder % 4] notes['月空' ] ||= Notes['月空' ][@remainder % 4] notes['三鏡' ] ||= Notes['三鏡' ][@remainder] notes['土府' ] ||= Notes['土府' ][@remainder] notes['土公' ] ||= Notes['土公' ][@remainder] notes end |
#_year_notes(notes = {}, dates = nil, conditions = {}) ⇒ Object
年の十二支で決まる暦注
155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/when_exe/region/japanese_residues.rb', line 155 def _year_notes(notes={}, dates=nil, conditions={}) notes['大将軍'] ||= Notes['大将軍'][@remainder] notes['大陰' ] ||= Notes['大陰' ][@remainder] notes['歳刑' ] ||= Notes['歳刑' ][@remainder] notes['歳破' ] ||= Notes['歳破' ][@remainder] notes['歳煞' ] ||= Notes['歳煞' ][@remainder] notes['黄幡' ] ||= Notes['黄幡' ][@remainder] notes['豹尾' ] ||= Notes['豹尾' ][@remainder] notes['歳次' ] ||= Notes['歳次' ][@remainder] notes end |