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

Inherits:
LunarPhases show all
Defined in:
lib/when_exe/region/japanese_notes.rb

Overview

月の位相による暦注

Constant Summary

Constants inherited from When::CalendarTypes::CalendarNote

BahaiNotes, ChineseNotes, DefaultNotes, When::CalendarTypes::CalendarNote::JavaneseNotes, When::CalendarTypes::CalendarNote::JulianDayNotes, MayanNotes, TibetanNotes, YiNotes

Constants included from Parts::Resource

Parts::Resource::LabelProperty

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

#domain, #name

Methods included from Parts::Resource

#[], #^, _decode, _encode, _extract_prefix, _instance, _parse, _path_with_prefix, _replace_tags, _setup_, #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

日の暦注



919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
# File 'lib/when_exe/region/japanese_notes.rb', line 919

def self._day_notes(notes, dates, conditions={})
  date = When.when?(dates.o_date.to_cal_date.to_s,
           {:frame=>dates.o_date.frame,
            :clock=>dates.l_date.frame.time_basis})
  phase, metsu = dates.cal4note.l_phases.position(date)

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

  # 月相
  unless notes['月相']
    date  = When.when?(dates.o_date.to_cal_date.to_s,
              {:frame=>dates.o_date.frame,
               :clock=>dates.l_date.frame.formula[-1].kind_of?(When::Ephemeris::ChineseTrueLunation) ?
                       When.Clock(-21600) : dates.l_date.frame.time_basis})
    range = dates.cal4note.l_phases.formula.thiti_range(date)
    notes['月相'] = if range
      range.include?( 7.5) ? '上弦' :
      range.include?(15.0) ? ''   :
      range.include?(22.5) ? '下弦' : nil
    else
      dates.o_date.frame.kind_of?(When::CalendarTypes::Julian) ? '' : nil
    end
  end

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