Class: When::CalendarNote::RomanNote
- Inherits:
-
When::CalendarNote
- Object
- BasicTypes::Object
- TM::Object
- TM::ReferenceSystem
- When::CalendarNote
- When::CalendarNote::RomanNote
- Defined in:
- lib/when_exe/region/roman.rb
Overview
古代ローマの暦注
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:[Roman]", # 年の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[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", [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:[month]", [When::BasicTypes::M17n, "names:[Month]" ] ], # 日の暦注 ---------------------------- [When::BasicTypes::M17n, "names:[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
BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, TibetanNotes, YiNotes
Constants included from Parts::Resource
Parts::Resource::LabelProperty
Instance Attribute Summary
Attributes inherited from When::CalendarNote
Attributes inherited from TM::ReferenceSystem
#domain_of_validity, #position
Attributes inherited from BasicTypes::Object
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
-
#nomen(date) ⇒ String
暦注 - 日の名前.
Methods inherited from When::CalendarNote
#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year
Methods inherited from TM::ReferenceSystem
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
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
暦注 - 日の名前
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/when_exe/region/roman.rb', line 289 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 |