Class: When::CalendarNote::DarianWeek

Inherits:
WorldWeek show all
Defined in:
lib/when_exe/region/martian.rb

Overview

Darian Week

Constant Summary collapse

Notes =
[When::BasicTypes::M17n, [
  "locale:[=en:, ja=ja:, alias]",
  "names:[Darian, ダリアン暦]",

  # 年の暦注 ----------------------------
  [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:[Solis=,    日曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Lunae=,    月曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Martis=,   火曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Mercurii=, 水曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Jovis=,    木曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Veneris=,  金曜日]", {'delta'=>7}],
      [DayOfWeek, "label:[Saturni=,  土曜日]", {'delta'=>7}]
    ]
  ]
]]

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

#event

Attributes inherited from TM::ReferenceSystem

#domain_of_validity, #position

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

#child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from WorldWeek

#week_day, #worldsday

Methods inherited from Week

#common_week

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

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

#[], #[]=, #_setup_

Dynamic Method Handling

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

Instance Method Details

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

当日または直前の solis の日

Parameters:

Returns:



161
162
163
164
165
166
167
168
169
# File 'lib/when_exe/region/martian.rb', line 161

def solis(date, parameter=nil)
  date  = When.Calendar('Darian').jul_trans(date, {:events=>['from_solis']})
  y,m,d = date.cal_date
  dow   = (d-1) % 7
  return date if dow == 0
  date += When::TM::PeriodDuration.new([0,0,-dow])
  date.events = ['from_solis']
  date
end

#week(date, base = nil) ⇒ Hash<:value=>When::CalendarNote::Week::DayOfWeek, :position=>Array<Integer>>

この日は何曜?

Parameters:

Returns:



179
180
181
182
183
# File 'lib/when_exe/region/martian.rb', line 179

def week(date, base=nil)
  date  = _to_date_for_note(date)
  index = (date.cal_date.last - 1) % 7
  {:value=>@days_of_week[index], :position=>[index, 7]}
end

#week_labels(date) ⇒ Array<When::CalendarNote::Week::DayOfWeek>

曜日の名前の一覧

Parameters:

Returns:



192
193
194
# File 'lib/when_exe/region/martian.rb', line 192

def week_labels(date)
  @days_of_week.child
end