Class: When::CalendarNote::ShireWeek

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

Overview

ホビット庄暦の暦週

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:[Shire]",

  # 年の暦注 ----------------------------
  [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]",
      "[Saturday,     土曜日]",
      "[Sunday,       日曜日]",
      "[Monday,       月曜日]",
      "[Tuesday,      火曜日]",
      "[Wednesday,    水曜日]",
      "[Thursday,     木曜日]",
      "[Friday,       金曜日]",
      "[lithe,        中日= ]",
      "[double,       重日= ]"
    ]
  ]
]]

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

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



82
83
84
# File 'lib/when_exe/region/shire.rb', line 82

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

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

オブジェクトの正規化



156
157
158
159
# File 'lib/when_exe/region/shire.rb', line 156

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

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

当日または直前の lithe の日

Parameters:

Returns:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/when_exe/region/shire.rb', line 96

def lithe(date, parameter=nil)
  event_name = 'lithe'
  date  = date.frame.jul_trans(date, {:events=>[event_name]})
  y,m,d = date.cal_date
  h,n   = (m+5).divmod(7)
  dow   = 182 * h[0] + 30 * n + d + 1
  if m==8
    case d
    when 2 ; dow = 0
    when 3 ; dow = date.frame._sum([y]) == 365 ? 1 : 0
    when 4 ; dow = 1
    end
  end
  return date if dow == 0
  date += When::TM::PeriodDuration.new([0,0,-dow])
  date.events = [event_name]
  date
end

#lithe_delta(parameter = nil) ⇒ Object



87
88
89
# File 'lib/when_exe/region/shire.rb', line 87

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

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

Note:

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

Parameters:

Returns:



# File 'lib/when_exe/region/shire.rb', line 115