Class: When::CalendarNote::WorldWeek

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

Overview

世界暦の暦週

Direct Known Subclasses

DarianWeek

Defined Under Namespace

Classes: Enumerator

Constant Summary collapse

NoteObjects =
[When::BasicTypes::M17n, [
  "namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
  "locale:[=en:, ja=ja:, alias]",
  "names:[World]",

  # 年の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[year]"
  ],

  # 月の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[month]",
    [When::BasicTypes::M17n,
      "names:[Month]"
    ]
  ],

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[day]",
    [When::BasicTypes::M17n,
      "names:[Week]",
      "[Sunday,    日曜日]",
      "[Monday,    月曜日]",
      "[Tuesday,   火曜日]",
      "[Wednesday, 水曜日]",
      "[Thursday,  木曜日]",
      "[Friday,    金曜日]",
      "[Saturday,  土曜日]",
      "[Worldsday, 無曜日]"
    ]
  ]
]]

Constants inherited from When::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes inherited from When::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#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::CalendarNote

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

Methods inherited from TM::ReferenceSystem

#domain, #name

Methods included from Parts::Resource

#[], #^, _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

#synchronize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#_delta(parameter = nil) ⇒ Object

イベントの標準的な間隔を返す



72
73
74
# File 'lib/when_exe/region/world.rb', line 72

def _delta(parameter=nil)
  return When::DurationP1W
end

#_normalize(args = [], options = {}) ⇒ Object

オブジェクトの正規化



130
131
132
133
# File 'lib/when_exe/region/world.rb', line 130

def _normalize(args=[], options={})
  @event ||= 'sunday'
  super
end

#week_day(date, parameter = nil) ⇒ When::TM::TemporalPosition

Note:

week_day は sunday, monday, tuesday, wednesday, thursday, friday, saturday に読み替えてください。

Parameters:

Returns:



# File 'lib/when_exe/region/world.rb', line 99

#worldsday(date, parameter = nil) ⇒ When::TM::TemporalPosition

当日または直前の worldsday の日

Parameters:

Returns:



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/when_exe/region/world.rb', line 86

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

#worldsday_delta(parameter = nil) ⇒ Object



77
78
79
# File 'lib/when_exe/region/world.rb', line 77

def worldsday_delta(parameter=nil)
  return When::TM::PeriodDuration.new([0,0,7*26+1])
end