Class: When::CalendarTypes::CalendarNote::Christian

Inherits:
When::CalendarTypes::CalendarNote show all
Defined in:
lib/when_exe/region/christian.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:[Christian]",

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

  # 月の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[month]",
    [When::BasicTypes::M17n,
      "names:[Month]"
    ]
  ],

  # 日の暦注 ----------------------------
  [When::BasicTypes::M17n,
    "names:[day]",
    [When::BasicTypes::M17n, "names:[Easter,    復活祭]"    ],
    [When::BasicTypes::M17n, "names:[Christmas, クリスマス]"]
  ]
]]

Constants inherited from When::CalendarTypes::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, JavaneseNotes, JulianDayNotes, MayanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues

Instance Attribute Summary collapse

Attributes inherited from When::CalendarTypes::CalendarNote

#event

Attributes inherited from TM::ReferenceSystem

#domain, #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::CalendarTypes::CalendarNote

#copy, #day, #duration, #enum_for, #include?, #month, #note?, #notes, #year

Methods inherited from TM::ReferenceSystem

#name

Methods inherited from BasicTypes::Object

#tap

Methods included from Parts::Resource

#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

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

#bInteger (readonly)

ベース

Returns:

  • (Integer)


517
518
519
# File 'lib/when_exe/region/christian.rb', line 517

def b
  @b
end

#cInteger (readonly)

月の位相の補正

Returns:

  • (Integer)


509
510
511
# File 'lib/when_exe/region/christian.rb', line 509

def c
  @c
end

#dInteger (readonly)

最も遅い満月の3月0日からの日数

Returns:

  • (Integer)


493
494
495
# File 'lib/when_exe/region/christian.rb', line 493

def d
  @d
end

#fInteger (readonly)

満月補正フラグ

Returns:

  • (Integer)


521
522
523
# File 'lib/when_exe/region/christian.rb', line 521

def f
  @f
end

#gInteger (readonly)

ガード

Returns:

  • (Integer)


513
514
515
# File 'lib/when_exe/region/christian.rb', line 513

def g
  @g
end

#nInteger (readonly)

平年数

Returns:

  • (Integer)


501
502
503
# File 'lib/when_exe/region/christian.rb', line 501

def n
  @n
end

#sInteger (readonly)

置閏周期

Returns:

  • (Integer)


505
506
507
# File 'lib/when_exe/region/christian.rb', line 505

def s
  @s
end

#wInteger (readonly)

週日補正フラグ

Returns:

  • (Integer)


489
490
491
# File 'lib/when_exe/region/christian.rb', line 489

def w
  @w
end

#xInteger (readonly)

クリスマスの3月0日からの日数

Returns:

  • (Integer)


497
498
499
# File 'lib/when_exe/region/christian.rb', line 497

def x
  @x
end

Instance Method Details

#_delta(parameter = nil) ⇒ Object Also known as: christmas_delta, easter_delta

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



565
566
567
# File 'lib/when_exe/region/christian.rb', line 565

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

#christmas(date, frame = nil) ⇒ Integer, When::TM::CalDate

クリスマス

Parameters:

Returns:

  • (Integer)

    クリスマスのユリウス通日(dateが西暦の年数の場合)

  • (When::TM::CalDate)

    クリスマスのWhen::TM::CalDate(yearがWhen::TM::TemporalPositionの場合)



532
533
534
535
536
# File 'lib/when_exe/region/christian.rb', line 532

def christmas(date, frame=nil)
  _event(date, 'christmas', frame) do |year, frame|
    @x - 1 + frame._coordinates_to_number(year, 2, 0)
  end
end

#easter(date, frame = nil) ⇒ Integer, When::TM::CalDate

復活祭

Parameters:

Returns:

  • (Integer)

    復活祭のユリウス通日(dateが西暦の年数の場合)

  • (When::TM::CalDate)

    復活祭のWhen::TM::CalDate(yearがWhen::TM::TemporalPositionの場合)



547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
# File 'lib/when_exe/region/christian.rb', line 547

def easter(date, frame=nil)
  _event(date, 'easter', frame) do |year, frame|
    golden = (year+@b) % @s + 1
    m      = (frame._lunar_equation(year) + 11*golden + @c) % 30
    if @f == 0
      m += 1 if m==0 || m==1 && golden>=@n
    else
      m += (golden-1) / @f
      m -= 30 if m>=@n
    end
    result  = frame._coordinates_to_number(year, 2, 0) + @d - 1 - m
    result += @g - (result-@w) % 7 if @w<7
    result
  end
end