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

初期設定



1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
# File 'lib/when_exe/region/indian.rb', line 1137

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 に移譲する



1149
1150
1151
1152
1153
1154
1155
1156
# File 'lib/when_exe/region/indian.rb', line 1149

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)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def formula
  @formula
end

#iriObject (readonly)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def iri
  @iri
end

#l_dateObject (readonly)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def l_date
  @l_date
end

#o_dateObject (readonly)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def o_date
  @o_date
end

#risesObject (readonly)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def rises
  @rises
end

#rootObject (readonly)



1133
1134
1135
# File 'lib/when_exe/region/indian.rb', line 1133

def root
  @root
end