Class: When::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

初期設定



1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
# File 'lib/when_exe/region/indian.rb', line 1068

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/Notes')['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 に移譲する



1080
1081
1082
1083
1084
1085
1086
1087
# File 'lib/when_exe/region/indian.rb', line 1080

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)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def formula
  @formula
end

#iriObject (readonly)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def iri
  @iri
end

#l_dateObject (readonly)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def l_date
  @l_date
end

#o_dateObject (readonly)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def o_date
  @o_date
end

#risesObject (readonly)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def rises
  @rises
end

#rootObject (readonly)



1064
1065
1066
# File 'lib/when_exe/region/indian.rb', line 1064

def root
  @root
end