Class: When::CalendarTypes::CalendarNote::JapaneseNote

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

Overview

日本暦注

Defined Under Namespace

Classes: Dates, Notes

Constant Summary collapse

NoteTypes =
[
# 開始年  暦法       土用のオフセット
  [-660, '儀鳳暦' ],
  [ 454, '元嘉暦' ],
  [ 697, '麟徳暦',   (Rational( 4,15) +  244) / 1340  ], # 啓蟄 <-> 雨水
  [ 764, '大衍暦',   (Rational(13,30) +  531) / 3040  ],
  [ 858, '五紀暦',   (Rational( 4,15) +  244) / 1340  ],
  [ 862, '宣明暦',   (Rational( 1, 2) + 1468) / 8400  ],
  [1685, ['timezone=32584.4/3600', '前貞享暦(節月)'  ]],
  [1687, ['timezone=32584.4/3600', '貞享暦(節月)'    ]],
  [1753, ['timezone=32584.4/3600', '前々宝暦暦(節月)']],
  [1754, ['timezone=32584.4/3600', '前宝暦暦(節月)'  ]],
  [1755, ['timezone=32584.4/3600', '宝暦暦(節月)'    ]],
  [1771, ['timezone=32584.4/3600', '修正宝暦暦(節月)']],
  [1798, ['timezone=32584.4/3600', '寛政暦(節月)'    ]],
  [1844, 'timezone=32584.4/3600'], # 京都平均太陽時の定朔定気法太陰太陽暦(天保暦の代用)
  [1873, 'timezone=33539/3600'  ], # 東京平均太陽時の定朔定気法太陰太陽暦
  [1888, 'timezone=9']             # 日本標準時の定朔定気法太陰太陽暦
].reverse
NoteObjects =
[When::BasicTypes::M17n, [
  "namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
  "locale:[=ja:]",
  "names:[日本暦注]",

  # 年の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[年]",
    [Notes, "label:[干支]",       'position:共通'],                # 干支
  # [Notes, "label:[干=ja:%%<十干>]",
  #                               'position:共通'],                # 干
  # [Notes, "label:[支=ja:%%<十二支>]",
  #                               'position:共通'],                # 支
    [Notes, "label:[九星]",       'position:民間'],                # 九星
    [Notes, "label:[大歳壇=]",    'position:暦序'],                # 干支
    [Notes, "label:[納音]",       'position:暦序',   'suffix:是'], # 干支
    [Notes, "label:[大歳=ja:%%<太歳神>]",
                                  'position:暦序',   'suffix:在'], # 干支
    [Notes, "label:[大将軍=ja:%%<大将軍_(方位神)>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[大陰=ja:%%<太陰神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[歳徳=ja:%%<歳徳神>]",
                                  'position:暦序',   'suffix:在'], # 干
    [Notes, "label:[歳刑=ja:%%<歳刑神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[歳破=ja:%%<歳破神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[歳煞=ja:%%<歳煞神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[黄幡=ja:%%<黄幡神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[豹尾=ja:%%<豹尾神>]",
                                  'position:暦序',   'suffix:在'], # 支
    [Notes, "label:[歳次=]",      'position:暦序',   'suffix:-'],  # 支
    [Notes, "label:[金神]",       'position:仮名暦', 'suffix:在']  # 干
  ],

  # 月の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[月]",
    [Notes, "label:[月名=ja:%%<月_(暦)>#%.<日本の和風月名>]",
                                  'position:月建'],       # 月の和名
  # [Notes, "label:[干支]",       'position:共通'],       # 干支
  # [Notes, "label:[干=ja:%%<十干>]",
  #                               'position:共通'],       # 干
  # [Notes, "label:[支=ja:%%<十二支>]",
  #                               'position:共通'],       # 支
    [Notes, "label:[九星]",       'position:民間'],       # 九星
    [Notes, "label:[月建=]",      'position:月建',   'suffix:-'],  # 干支
    [Notes, "label:[天道=]",      'position:月建',   'suffix:-'],  # 干
    [Notes, "label:[天徳=]",      'position:月建',   'suffix:在'], # 干
    [Notes, "label:[月煞=]",      'position:月建',   'suffix:在'], # 干
    [Notes, "label:[用時=]",      'position:月建'],                # 干
    [Notes, "label:[月徳=]",      'position:月建',   'suffix:在'], # 干
    [Notes, "label:[月徳合=]",    'position:月建',   'suffix:在'], # 干
    [Notes, "label:[月空=]",      'position:月建',   'suffix:在'], # 干
    [Notes, "label:[三鏡=]",      'position:月建'],                # 干
    [Notes, "label:[土府=]",      'position:月建',   'suffix:在'], # 干
    [Notes, "label:[土公=ja:%%<土公神>]",
                                  'position:月建',   'suffix:在']  # 干
  ],

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[日]",
    [Notes, "label:[干支]",       'position:共通'],                # 干支
  # [Notes, "label:[干=ja:%%<十干>]",
  #                               'position:共通'],                # 干
  # [Notes, "label:[支=ja:%%<十二支>]",
  #                               'position:共通'],                # 支
    [Notes, "label:[納音]",       'position:共通',   'suffix:是'], # 干支
    [Notes, "label:[十二直]",     'position:共通'],                # 支 節月
    [Notes, "label:[七曜]",       'position:共通'],                # 七曜
    [Notes, "label:[廿八宿=ja:%%<二十八宿>]",
                                  'position:共通'],                # 廿八宿
    [Notes, "label:[廿七宿=ja:%%<二十八宿>]",
                                  'position:共通'],                # 暦月 暦日
    [Notes, "label:[九星]",       'position:民間'],                # 九星
    [Notes, "label:[六曜]",       'position:民間'],                # 暦月 暦日
    [Notes, "label:[祝祭日]",     'position:祝祭日'],              # 暦月 暦日 (七曜)

    [Notes, "label:[節中=]",      'position:時候'],                # 太陽黄経
    [Notes, "label:[廿四節気=ja:%%<二十四節気>]",
                                  'position:時候'],                # 太陽黄経
    [Notes, "label:[七十二候]",   'position:時候'],                # 太陽黄経
    [Notes, "label:[六十卦=]",    'position:時候'],                # 太陽黄経
    [Notes, "label:[入梅]",       'position:雑節'],                # 干 太陽黄経

    [Notes, "label:[大禍=ja:%%<暦注下段>#%.<大禍日>]",
                                  'position:上段 上段 欄外 欄外', 'suffix:日'],    # 支 節月
    [Notes, "label:[滅門=ja:%%<暦注下段>#%.<滅門日>]",
                                  'position:上段 上段 欄外 欄外', 'suffix:日'],    # 支 節月
    [Notes, "label:[狼藉=ja:%%<暦注下段>#%.<狼藉日>]",
                                  'position:上段 上段 欄外 欄外', 'suffix:日'],    # 支 節月

    [Notes, "label:[甘露=]",      'position:上段 上段 上段 上段', 'suffix:日'],    # 七曜 廿七宿
    [Notes, "label:[金剛峯=]",    'position:上段 上段 上段 上段'],                 # 七曜 廿七宿
    [Notes, "label:[羅刹=]",      'position:中段 中段 上段 上段'],                 # 七曜 廿七宿

    [Notes, "label:[大将軍=ja:%%<大将軍_(方位神)>]",
                                  'position:上段 上段 上段 上段',   'suffix:-'],   # 干支 節年
    [Notes, "label:[天一=ja:%%<天一神>]",
                                  'position:上段 上段 上段 上段',   'suffix:-'],   # 干支
    [Notes, "label:[土公=ja:%%<土公神>]",
                                  'position:上段 上段 上段 上段'],                 # 干支
    [Notes, "label:[歳下食=ja:%%<暦注下段>#%.<歳下食>]",
                                  'position:上段 上段 上段 上段'],                 # 干支 節年
    [Notes, "label:[忌遠行=]",    'position:上段 中段 上段 上段'],                 # 支 節月
    [Notes, "label:[忌夜行=]",    'position:上段 中段 上段 上段'],                 # 支 節月
    [Notes, "label:[下食時=ja:%%<暦注下段>#%.<時下食>]",
                                  'position:上段 上段 上段 上段'],                 # 支 節月 貞享暦で一部廃止
    [Notes, "label:[天間=]",      'position:上段 中段 上段 中段上'],               # 干支 節月
    [Notes, "label:[不視病=]",    'position:上段 上段 上段 上段'],                 # 干
    [Notes, "label:[不問疾=]",    'position:上段 上段 上段 上段'],                 # 干
    [Notes, "label:[不弔人=]",    'position:上段 上段 上段 上段'],                 # 支
    [Notes, "label:[社=ja:%%<社日>]",
                                  'position:中段 中段 中段 中段', 'suffix:日'],    # 干 太陽黄経
    [Notes, "label:[三伏]",       'position:中段 中段 中段 中段'],                 # 干 太陽黄経
    [Notes, "label:[除手足甲=]",  'position:中段 中段 中段 中段'],                 # 晦(除手足甲)、支(片方のみ), 没滅凶会日×
    [Notes, "label:[沐浴=]",      'position:中段 中段 中段 中段'],                 # 支 没滅凶会日×
    [Notes, "label:[臘=ja:%%<臘日>]",
                                  'position:中段 中段 中段 中段', 'suffix:日'],    # 支 太陽黄経
    [Notes, "label:[伐=]",        'position:上段 中段 中段 中段上', 'suffix:日'],  # 干支
    [Notes, "label:[五墓=ja:%%<暦注下段>#%.<五墓日>]",
                                  'position:上段 上段 中段 中段下', 'suffix:日'],  # 干支
    [Notes, "label:[九虎=]",      'position:上段 中段 中段 中段上'],               # 干支 節月
    [Notes, "label:[八龍=]",      'position:上段 上段 中段 中段上'],               # 干支 節月
    [Notes, "label:[七鳥=]",      'position:上段 上段 中段 中段上'],               # 干支 節月
    [Notes, "label:[六蛇=]",      'position:上段 上段 中段 中段上'],               # 干支 節月

    [Notes, "label:[没=ja:%%<没日>]",
                                  'position:中段 中段 中段 中段', 'suffix:日'],    # 太陽黄経
    [Notes, "label:[日食]",       'position:中段 中段 中段 中段'],                 # 日食表
    [Notes, "label:[滅=ja:%%<滅日]",
                                  'position:中段 中段 中段 中段', 'suffix:日'],    # 月の位相
    [Notes, "label:[月食]",       'position:中段 中段 中段 中段'],                 # 月食表
    [Notes, "label:[月相]",       'position:中段 中段 中段 中段'],                 # 月の位相
    [Notes, "label:[土用事=ja:%%<土用>]",
                                  'position:中段 中段 中段 中段'],                 # 太陽黄経
    [Notes, "label:[伏龍=]",      'position:上段 上段 下段 下段', 'suffix:在'],    # 太陽黄経

    [Notes, "label:[凶会=ja:%%<暦注下段>#%.<凶会日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Notes, "label:[大小歳=]",    'position:下段 下段 下段 下段'],                 # 干支 節月
    [Notes, "label:[歳徳=ja:%%<歳徳神>]",
                                  'position:下段 下段 下段 下段',],                # 干 節年 凶会日× ~合も
    [Notes, "label:[天恩=ja:%%<暦注下段>#%.<天恩日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 干支 節月 凶会日×
    [Notes, "label:[天赦=ja:%%<暦注下段>#%.<天赦日>]",
                                  'position:下段 下段 下段 下段'],                 # 干支 節月
    [Notes, "label:[母倉=ja:%%<暦注下段>#%.<母倉日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 支 節月 凶会日×
    [Notes, "label:[月徳=]",      'position:下段 下段 下段 下段',],                # 干 節月 凶会日× ~合も
    [Notes, "label:[九坎=]",      'position:下段 下段 下段 下段'],                 # 支 節月
    [Notes, "label:[帰忌=ja:%%<暦注下段>#%.<帰忌日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 支 節月
    [Notes, "label:[血忌=ja:%%<暦注下段>#%.<血忌日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 支 節月
    [Notes, "label:[無翹=]",      'position:下段 下段 下段 下段'],                 # 支 節月
    [Notes, "label:[厭=]",        'position:下段 下段 下段 下段'],                 # 支 節月
    [Notes, "label:[重=ja:%%<暦注下段>#%.<重日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 支
    [Notes, "label:[復=ja:%%<暦注下段>#%.<復日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 干 節月
    [Notes, "label:[月煞=]",      'position:下段 下段 下段 下段', 'suffix:在'],    # 支 節月
    [Notes, "label:[往亡=ja:%%<暦注下段>#%.<往亡日>]",
                                  'position:下段 下段 下段 下段', 'suffix:日'],    # 太陽黄経
    [Notes, "label:[日遊=ja:%%<日遊神>]",
                                  'position:最下段', 'suffix:在'],                 # 干支

    [Notes, "label:[受死=ja:%%<暦注下段>#%.<受死日>]",
                                  'position:仮名暦', 'suffix:日'], # 支 節月
    [Notes, "label:[彼岸]",       'position:仮名暦'],              # 太陽黄経
    [Notes, "label:[八専]",       'position:仮名暦'],              # 干支
    [Notes, "label:[金神間日=ja:%%<金神>#%.<金神の遊行・間日>]",
                                  'position:仮名暦'],              # 支 節月
    [Notes, "label:[天火=ja:%%<暦注下段>#%.<天火日>]",
                                  'position:仮名暦', 'suffix:日'], # 支 節月
    [Notes, "label:[地火=ja:%%<暦注下段>#%.<地火日>]",
                                  'position:仮名暦', 'suffix:日'], # 支 節月
    [Notes, "label:[人火=]",      'position:仮名暦'],              # 支 節月
    [Notes, "label:[雷火=]",      'position:仮名暦'],              # 支 節月
    [Notes, "label:[赤舌=ja:%%<赤舌日>]",
                                  'position:仮名暦', 'suffix:日'], # 暦月 暦日
    [Notes, "label:[十死=ja:%%<暦注下段>#%.<十死日>]",
                                  'position:仮名暦', 'suffix:日'], # 支 節月
    [Notes, "label:[道虚=]",      'position:仮名暦', 'suffix:日'], # 暦日
    [Notes, "label:[大明=ja:%%<暦注下段>#%.<大明日>]",
                                  'position:仮名暦', 'suffix:日'], # 干支
    [Notes, "label:[赤口=ja:%%<赤口日>]",
                                  'position:仮名暦', 'suffix:日'], # 暦月 暦日
    [Notes, "label:[甲子待=ja:%%<甲子>]",
                                  'position:仮名暦'],              # 干支
    [Notes, "label:[庚申待]",     'position:仮名暦'],              # 干支
    [Notes, "label:[犯土]",       'position:仮名暦'],              # 干支
    [Notes, "label:[十方暮]",     'position:仮名暦'],              # 干支
    [Notes, "label:[一粒万倍=ja:%%<一粒万倍日>]",
                                  'position:仮名暦', 'suffix:日'], # 支 節月
    [Notes, "label:[天福=]",      'position:仮名暦'],              # 支 節月
    [Notes, "label:[地福=]",      'position:仮名暦'],              # 支 節月
    [Notes, "label:[地五福=]",    'position:仮名暦'],              # 支 節月
    [Notes, "label:[三隣亡]",     'position:仮名暦'],              # 支 節月
    [Notes, "label:[不成就=ja:%%<不成就日>]",
                                  'position:仮名暦', 'suffix:日'], # 暦月 暦日/晦日

    [Notes, "label:[三宝吉=]",    'position:上段 上段 上段 上段'],                 # 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Notes, "label:[神吉=ja:%%<暦注下段>#%.<神日>]",
                                  'position:上段 上段 中段 中段上', 'suffix:日'],  # 干支 節月
    [Notes, "label:[雑事吉=]",    'position:雑事吉'],                              # 干支 節月(宣明暦以前)/暦月(貞享暦以降)
    [Notes, "label:[小字注=]",    'position:下段小字 下段小字 下段小字 下段小字'], # 干支 節月(宣明暦以前)/暦月(貞享暦以降)
  ]
]]
NoteMethods =
[:year_notes, :month_notes, :day_notes]

Constants inherited from When::CalendarTypes::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, 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, #domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

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

Instance Method Summary collapse

Methods inherited from When::CalendarTypes::CalendarNote

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

Methods inherited from TM::ReferenceSystem

#name

Methods inherited from BasicTypes::Object

#tap

Methods included from Parts::Resource

#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, _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

Instance Method Details

#notes(date, options = {}) ⇒ Hash, ...

Note:

return 値の [Hash] の要素は下記の通り :note => 暦注要素 (When::CalendarTypes::JapaneseNote::Notes) :value => 暦注の値 (String or When::BasicTypes::M17n または、その Array) :position => 具注暦でのその暦注の配置場所(String)

暦注の計算

Parameters:

Returns:

  • (Hash)

    :notes が String の場合

  • (Array<Hash>)

    上記に該当せず、:indices が Integer の場合

  • (Array<Array<Hash>>)

    上記のいずれにも該当しない場合



358
359
360
361
362
363
364
# File 'lib/when_exe/region/japanese_notes.rb', line 358

def notes(date, options={})
  dates, indices, notes, conditions, options = _parse(date, options)
  _result(indices.map {|i|
    next [] unless i <= dates.o_date.precision
    send(NoteMethods[i-1], dates, notes[i-1], conditions)
  }, options)
end