require 'bigdecimal' require 'calc_sun' require 'date' require 'eot' # This is for equationoftime gem but conversion is in process. # class AnalemmaDataTable attr_accessor :year, :eot, :finish, :start, :span, :page, :table def initialize @year = Time.now.utc.year @eot = Eot.new @cs = CalcSun.new @start = Date.parse("#{@year}-1-1") @finish = Date.parse("#{@year}-12-31") @span = 0..(@finish - @start).to_i @page = '
' @page << '' @page << '' build end def page_head @page << "' @page << ' | yday | ' @page << 'date | ' end def table_head @page << 'Julian No. | ' @page << 'Oblique ΔT | ' @page << 'Orbital ΔT | ' @page << 'Total ΔT | ' @page << 'Right Ascension | ' @page << 'Declination | ' @page << '#{@eot.show_minutes(@eot.time_delta_oblique)} | " @page << "#{@eot.show_minutes(@eot.time_delta_orbit)} | " @page << "#{@eot.show_minutes(@eot.time_eot)} | " @page << "#{@eot.string_time((@eot.ra_sun * Eot::R2D) / 15.0)} | " @page << "#{@cs.declination(inc)} | " end def table_body @span.each do |i| setup_each_iteration(i) @page << '
---|---|---|---|---|---|---|---|---|---|---|---|
' @page << " | #{(@start + i).yday} | " @page << "#{(@start + i).month}/#{(@start + i).day} | " @page << "#{(@start + i).jd}.0 | " table_data(i) end end def table_foot @page << '