Class: When::CalendarNote::ChineseLuniSolar
- Inherits:
-
When::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarNote
- When::CalendarNote::ChineseLuniSolar
- Defined in:
- lib/when_exe/region/chinese/notes.rb
Overview
暦月の暦注
Direct Known Subclasses
Constant Summary collapse
- Holidays =
節日の日付
{ [1, 1] => When.M17n('ChineseLuniSolarHoliday::元日'), [1, 7] => When.M17n('ChineseLuniSolarHoliday::人日'), [1,15] => When.M17n('ChineseLuniSolarHoliday::小正月'), [3, 3] => When.M17n('ChineseLuniSolarHoliday::弥生節句'), [5, 5] => When.M17n('ChineseLuniSolarHoliday::端午節句'), [7, 7] => When.M17n('ChineseLuniSolarHoliday::七夕節句'), [7,15] => When.M17n('ChineseLuniSolarHoliday::お盆'), [8, 1] => When.M17n('ChineseLuniSolarHoliday::田実節句'), [9, 9] => When.M17n('ChineseLuniSolarHoliday::重陽節句') }
- Notes =
年月日の暦注
[When::BasicTypes::M17n, [ "locale:[=ja:, en=en:, zh=zh:, alias=en:]", "names:[暦月の暦注=, LuniSolarNote=]", # 年の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[年の暦注=, note for year=, prefix:YearNote=, *alias:year=]", [When::BasicTypes::M17n, "names:[年の暦注=, note for year=, *alias:Year=]" ] ], # 月の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[月の暦注=, note for month=, prefix:MonthNote=, *alias:month=]", [When::BasicTypes::M17n, "names:[月の名前=ja:%%<月_(暦)>, month name=en:Month, 該月的名稱=, *alias:Month=]" ] ], # 日の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[日の暦注=, note for day=, prefix:DayNote=, *alias:day]", "[週, *Week, 星期 ]", # 七曜 "[干支, *StemBranch=en:Sexagenary_cycle, 干支 ]", # 六十干支 "[二十四節気, *SolarTerm=en:Solar_term, 節気=zh:%%<节气>]", # 二十四節気 "[没=, *Motsu=, 没= ]", # 没 "[節日=, *Holiday=, 歲時節日= ]" # 節句など ] ]]
Constants inherited from When::CalendarNote
Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, Javanese, JulianDay, Mayan, Tibetan, Yis
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
Attributes inherited from TM::ReferenceSystem
#domain_of_validity, #position
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#_day_notes(date, options = {}) ⇒ Hash
日の暦注.
-
#_normalize(args = [], options = {}) ⇒ Object
オブジェクトの正規化.
-
#holiday(date, options = {}) ⇒ When::BasicTypes::M17n
節.
-
#motsu(date, options = {}) ⇒ When::BasicTypes::M17n
没.
-
#solarterm(date, options = {}) ⇒ When::Coordinates::Residue
二十四節気.
-
#stembranch(date, options = {}) ⇒ When::Coordinates::Residue
日の干支.
-
#week(date, options = {}) ⇒ When::Coordinates::Residue
七曜.
-
#year(date, options = {}) ⇒ When::Coordinates::Residue
年の干支.
Methods inherited from When::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes
Methods inherited from TM::ReferenceSystem
Methods included from Parts::Resource
#[], #^, _instance, _setup_, _setup_info, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #parent, #registered?, root_dir
Methods included from Parts::Resource::Pool
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Method Details
#_day_notes(date, options = {}) ⇒ Hash
日の暦注
174 175 176 177 178 179 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/chinese/notes.rb', line 174 def _day_notes(date, ={}) s_date = When.when?(date.to_cal_date.to_s, {:frame=>date.frame, :clock=>(date.frame.kind_of?(When::CalendarTypes::EphemerisBasedSolar) || !date.frame.twin ? date.frame : When.Calendar(date.frame.twin))._time_basis[0] }) # 没 notes = {} longitude, motsu = SolarTerms.new('formula'=>date.frame.formula[0]).position(s_date) if motsu == 0 notes['没'] = '没' unless date.most_significant_coordinate >= 1685 && date.frame.iri =~ /JapaneseTwin/ return notes end # 廿四節気 div, mod = longitude.divmod(15) if mod == 0 note = (div - 21) % 24 div, mod = note.divmod(2) notes['二十四節気'] ||= When.Resource(date.frame.iri =~ /戊寅|麟徳|儀鳳/ ? '_co:Common?V=0618' : '_co:Common')['二十四節気::*'][(note-3) % 24] end notes end |
#_normalize(args = [], options = {}) ⇒ Object
オブジェクトの正規化
161 162 163 164 |
# File 'lib/when_exe/region/chinese/notes.rb', line 161 def _normalize(args=[], ={}) @_all_keys ||= [%w(Year), %w(Month), %w(Week StemBranch SolarTerm Holiday)] super end |
#holiday(date, options = {}) ⇒ When::BasicTypes::M17n
節
156 157 158 |
# File 'lib/when_exe/region/chinese/notes.rb', line 156 def holiday(date, ={}) Holidays[[+date.cal_date[When::MONTH-1], date.cal_date[When::DAY-1]]] end |
#motsu(date, options = {}) ⇒ When::BasicTypes::M17n
没
144 145 146 |
# File 'lib/when_exe/region/chinese/notes.rb', line 144 def motsu(date, ={}) _day_notes(date, )['没'] end |
#solarterm(date, options = {}) ⇒ When::Coordinates::Residue
二十四節気
132 133 134 |
# File 'lib/when_exe/region/chinese/notes.rb', line 132 def solarterm(date, ={}) _day_notes(date, )['二十四節気'] end |
#stembranch(date, options = {}) ⇒ When::Coordinates::Residue
日の干支
120 121 122 |
# File 'lib/when_exe/region/chinese/notes.rb', line 120 def stembranch(date, ={}) When.Resource('_co:Common::干支')[(date.to_i-11) % 60] end |
#week(date, options = {}) ⇒ When::Coordinates::Residue
七曜
108 109 110 |
# File 'lib/when_exe/region/chinese/notes.rb', line 108 def week(date, ={}) When.Resource('_co:Common::Week')[date.to_i % 7] end |
#year(date, options = {}) ⇒ When::Coordinates::Residue
年の干支
96 97 98 |
# File 'lib/when_exe/region/chinese/notes.rb', line 96 def year(date, ={}) When.Resource('_co:Common::干支')[(date.most_significant_coordinate-4) % 60] end |