Class: When::CalendarNote::SovietSixDayWeek

Inherits:
Week show all
Defined in:
lib/when_exe/region/russian.rb

Overview

六曜

Constant Summary collapse

WeekLength =
[7,6,7,6,7,6,7,7,6,7,6,7]
Notes =

暦注要素の定義

[When::BasicTypes::M17n, [
  "locale:[=en:, ja=ja:, alias]",
  "names:[SovietSixDay]",

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[day]",
    [When::BasicTypes::M17n,
      "names:[SixDay, 六曜]",
      [DayOfWeek, "label:[Первый=      ]", {'delta'=>6}],
      [DayOfWeek, "label:[Второй=      ]", {'delta'=>6}],
      [DayOfWeek, "label:[Третий=      ]", {'delta'=>6}],
      [DayOfWeek, "label:[Четвертый=]", {'delta'=>6}],
      [DayOfWeek, "label:[Пятый=        ]", {'delta'=>6}],
      [DayOfWeek, "label:[Шестой=      ]", {'delta'=>6}],
      [DayOfWeek, "label:[Out of week=       ]", {'delta'=>6}]
    ]
  ]
]]

Constants inherited from When::CalendarNote

Bahai, CalendarDepend, Chinese, CommonWithRokuyo, CommonWithSovietFiveDay, CommonWithSovietSixDay, Default, HashProperty, Javanese, JulianDay, Mayan, Tibetan, Yis

Constants included from Parts::Resource

Parts::Resource::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

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

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods inherited from Week

#_column_for_week_included, #_range_for_week_included, #common_week, #week_labels

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

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

#_to_date_for_note(date) ⇒ Object

暦日をグレゴリオ暦日に変換



206
207
208
209
# File 'lib/when_exe/region/russian.rb', line 206

def _to_date_for_note(date)
  return date if date.frame.kind_of?(When::CalendarTypes::Gregorian)
  return When::Gregorian ^ date
end

#first(date, base = nil) ⇒ Object



189
190
191
192
193
194
195
# File 'lib/when_exe/region/russian.rb', line 189

def first(date, base=nil)
  dow   = _to_date_for_note(date).cal_date[When::DAY-1]
  index = dow == 31 ? 6 : (dow - 1) % 6
  date -= index if index > 0
  date.events = [@days_of_week[index]]
  date
end

#first_delta(parameter = nil) ⇒ Object



198
199
200
# File 'lib/when_exe/region/russian.rb', line 198

def first_delta(parameter=nil)
  When::P6D
end

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

この日は何曜?

Parameters:

Returns:



180
181
182
183
184
185
# File 'lib/when_exe/region/russian.rb', line 180

def sixday(date, base=nil)
  date  = _to_date_for_note(date)
  dow   = date.cal_date[When::DAY-1]
  index = dow == 31 ? 6 : (dow - 1) % 6
  {:value=>@days_of_week[index], :position=>[index, WeekLength[(base||date).cal_date[When::MONTH-1]-1]]}
end