Class: When::CalendarTypes::CalendarNote::HinduNote::Dates

Inherits:
Object
  • Object
show all
Defined in:
lib/when_exe/region/indian.rb

Overview

pancanga 計算に必要となる情報をまとめた内部クラス

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ Dates

初期設定


941
942
943
944
945
946
947
948
949
950
# File 'lib/when_exe/region/indian.rb', line 941

def initialize(date)
  @o_date  = date
  clock    = date.clock
  frame    = date.frame if date.frame.kind_of?(When::CalendarTypes::HinduLuniSolar)
  @l_date  = (frame || When.Calendar('HinduLuniSolar?note=HinduNote')).jul_trans(date.to_i, {:clock=>'+05:30'})
  @root    = When.CalendarNote('HinduNote/NoteObjects')['day']
  @formula = @l_date.frame.formula[-1]
  @iri     = @formula.iri
  @rises   = [@formula.sunrise(@l_date), @formula.sunrise(@l_date+When.Duration('P1D'))]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object

その他のメソッドは @l_date に移譲する


953
954
955
956
957
958
959
960
# File 'lib/when_exe/region/indian.rb', line 953

def method_missing(name, *args, &block)
  self.class.module_eval %Q{
    def #{name}(*args, &block)
      @l_date.send("#{name}", *args, &block)
    end
  } unless When::Parts::MethodCash.escape(name)
  @l_date.send(name, *args, &block)
end

Instance Attribute Details

#formulaObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def formula
  @formula
end

#iriObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def iri
  @iri
end

#l_dateObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def l_date
  @l_date
end

#o_dateObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def o_date
  @o_date
end

#risesObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def rises
  @rises
end

#rootObject (readonly)


937
938
939
# File 'lib/when_exe/region/indian.rb', line 937

def root
  @root
end