Class: When::CalendarNote::WorldWeek
- Inherits:
-
Week
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarNote
- Week
- When::CalendarNote::WorldWeek
- Defined in:
- lib/when_exe/region/world.rb
Overview
世界暦の暦週
Direct Known Subclasses
Constant Summary collapse
- Notes =
暦注要素の定義
[When::BasicTypes::M17n, [ "locale:[=en:, ja=ja:, alias]", "names:[World, 世界暦]", # 年の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for year=, 年の暦注=, *year]" ], # 月の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for month=, 月の暦注=, *month]", [When::BasicTypes::M17n, "names:[month name=en:Month, 月の名前=ja:%%<月_(暦)>, zh:該月的名稱=, *alias:Month=]" ] ], # 日の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[note for day=, 日の暦注=, *day]", [When::BasicTypes::M17n, "names:[Week, 週, zh:星期]", [DayOfWeek, "label:[Sunday, 日曜日, /date/day_names/0]", {'delta'=>7}], [DayOfWeek, "label:[Monday, 月曜日, /date/day_names/1]", {'delta'=>7}], [DayOfWeek, "label:[Tuesday, 火曜日, /date/day_names/2]", {'delta'=>7}], [DayOfWeek, "label:[Wednesday, 水曜日, /date/day_names/3]", {'delta'=>7}], [DayOfWeek, "label:[Thursday, 木曜日, /date/day_names/4]", {'delta'=>7}], [DayOfWeek, "label:[Friday, 金曜日, /date/day_names/5]", {'delta'=>7}], [DayOfWeek, "label:[Saturday, 土曜日, /date/day_names/6]", {'delta'=>7}], [DayOfWeek, "label:[Worldsday=en:The_World_Calendar#Features, 週外日=]", {'delta'=>366}], ], "[Common_Week=]" ] ]]
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
-
#week(date, base = nil) ⇒ Hash<:value=>When::CalendarNote::Week::DayOfWeek, :position=>Array<Integer>>
この日は何曜?.
- #week_day(date, parameter = nil) ⇒ When::TM::TemporalPosition
-
#worldsday(date, parameter = nil) ⇒ When::TM::TemporalPosition
当日または直前の worldsday の日.
Methods inherited from Week
Methods inherited from When::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
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
#week(date, base = nil) ⇒ Hash<:value=>When::CalendarNote::Week::DayOfWeek, :position=>Array<Integer>>
この日は何曜?
130 131 132 133 134 135 136 |
# File 'lib/when_exe/region/world.rb', line 130 def week(date, base=nil) date = _to_date_for_note(date) y, m, d = date.cal_date index = ExtraDayInYear[[m,d]] || (FirstDayOfWeek[m-1] + d - 1) % 7 length = WeekLength[[m, (base||date).length(When::MONTH)]] || 7 {:value=>@days_of_week[index], :position=>[index, length]} end |
#week_day(date, parameter = nil) ⇒ When::TM::TemporalPosition
week_day は sunday, monday, tuesday, wednesday, thursday, friday, saturday に読み替えてください。
|
# File 'lib/when_exe/region/world.rb', line 97
|
#worldsday(date, parameter = nil) ⇒ When::TM::TemporalPosition
当日または直前の worldsday の日
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/when_exe/region/world.rb', line 84 def worldsday(date, parameter=nil) event_name = 'worldsday' date = When.Calendar('World').jul_trans(date, {:events=>event_name}) y,m,d = date.cal_date h, m = (m-1).divmod(6) return date if m == 5 && d == 31 dow = [0, 31, 61, 91, 122, 152][m] + d dow += 182 if h == 1 && When.Calendar('World')._sum([y]) == 365 date += When::TM::PeriodDuration.new([0,0,-dow]) date.events = [event_name] date end |