Class: When::CalendarTypes::CalendarNote::LunarPhases

Inherits:
LuniSolarPositions show all
Defined in:
lib/when_exe/calendartypes.rb,
lib/when_exe/region/japanese_notes.rb

Overview

月の位相による暦注

Constant Summary collapse

Phases =
{7.0=>'上弦', 8.0=>'上弦', 15.0=>'', 22.0=>'下弦', 23.0=>'下弦'}

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

Attributes inherited from LuniSolarPositions

#delta, #den, #formula, #margin, #num

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

Class Method Summary collapse

Methods inherited from LuniSolarPositions

#position, #term, #term_delta

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

Class Method Details

._day_notes(notes, dates, conditions = {}) ⇒ Object

日の暦注



691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/when_exe/region/japanese_notes.rb', line 691

def self._day_notes(notes, dates, conditions={})
  return notes unless dates.year < 1685
  date = When.when?(dates.o_date.to_cal_date.to_s,
                    {:clock=>When.Clock(dates.l_date.frame.timezone[0]*86400)})
  phase, metsu = dates.l_phases.position(date)
  phase = Phases[phase]

  # 滅
  notes[''] = '' if metsu == 2

  # 月相
  notes['月相'] ||=
    // !~ phase ? phase : dates.l_phases.position(date, 0.5)[0] % 15 == 8.0 ? phase : nil

  # 月食
  notes['月食']        = nil # 計算できないので、偽としておく
  notes
end