Class: When::CalendarNote::Roman

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

Overview

古代ローマの暦注

Constant Summary collapse

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

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

    [When::Coordinates::Residue,
      "label:[Solar=en:Solar_cycle_(calendar), 太陽章=]", "divisor:28", "year:-8",
    ],

    [When::Coordinates::Residue,
      "label:[Metonic=en:Metonic_cycle, 太陰章=]", "divisor:19", "year:0",
    ],

    [When::Coordinates::Residue,
      "label:[Indiction, インディクティオ]", "divisor:15", "year:-2", "format:[%s=en:Indiction, %s=ja:インディクティオ]",
      [When::Coordinates::Residue, "label:[I=   ]", "remainder:  0"],
      [When::Coordinates::Residue, "label:[II=  ]", "remainder:  1"],
      [When::Coordinates::Residue, "label:[III= ]", "remainder:  2"],
      [When::Coordinates::Residue, "label:[IV=  ]", "remainder:  3"],
      [When::Coordinates::Residue, "label:[V=   ]", "remainder:  4"],
      [When::Coordinates::Residue, "label:[VI=  ]", "remainder:  5"],
      [When::Coordinates::Residue, "label:[VII= ]", "remainder:  6"],
      [When::Coordinates::Residue, "label:[VIII=]", "remainder:  7"],
      [When::Coordinates::Residue, "label:[IX=  ]", "remainder:  8"],
      [When::Coordinates::Residue, "label:[X=   ]", "remainder:  9"],
      [When::Coordinates::Residue, "label:[XI=  ]", "remainder: 10"],
      [When::Coordinates::Residue, "label:[XII= ]", "remainder: 11"],
      [When::Coordinates::Residue, "label:[XIII=]", "remainder: 12"],
      [When::Coordinates::Residue, "label:[XIV= ]", "remainder: 13"],
      [When::Coordinates::Residue, "label:[XV=  ]", "remainder: 14"],
    ]
  ],

  # 月の暦注 ----------------------------
  [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:[Nomen]"
    ]
  ]
]]
Order =
[
  'a.d. bis VI',
  'prid.',    'a.d. III',  'a.d. IV',    'a.d. V',   'a.d. VI',   'a.d. VII', 'a.d. VIII', 
  'a.d. IX',  'a.d. X',    'a.d. XI',    'a.d. XII', 'a.d. XIII', 'a.d. XIV', 'a.d. XV', 
  'a.d. XVI', 'a.d. XVII', 'a.d. XVIII', 'a.d. XIX', 'a.d. XX',   'a.d. XXI', 'a.d. XXII'
]
LongMonths =
[3, 5, 7, 10, When.Pair(11,0.5), When.Pair(11,1.5)]
LongType =
[1, 2..6, 7, 8..14, 15]
ShortType =
[1, 2..4, 5, 6..12, 13]

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 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

#nomen(date) ⇒ String

暦注 - 日の名前

Parameters:

Returns:



296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/when_exe/region/roman.rb', line 296

def nomen(date)
  y, m, d = date.cal_date
  month_name = _abbr_of_month(date)
  kal, to_nonae, nonae, to_idus, idus = LongMonths.include?(m) ? LongType : ShortType
  case d
  when kal      ; return                     'Kal. ' + month_name
  when to_nonae ; return Order[nonae - d] + ' Non. ' + month_name
  when nonae    ; return                     'Non. ' + month_name
  when to_idus  ; return Order[idus  - d] + ' Id. '  + month_name
  when idus     ; return                     'Id. '  + month_name
  end
  this_month = date.floor(When::MONTH)
  next_month = this_month.succ
  month_name = _abbr_of_month(next_month)
  rest = next_month.to_i - date.to_i
  if m == 2 && next_month.to_i - this_month.to_i == 29
    return Order[0] + ' Kal. ' + month_name if rest == 5
    rest -= 1 if rest > 5
  end
  return Order[rest] + ' Kal. ' + month_name
end