Class: PaymentDay::Views

Inherits:
Object
  • Object
show all
Defined in:
lib/payment_day.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(views, options) ⇒ Views

Returns a new instance of Views.



130
131
132
133
134
135
136
137
138
139
140
# File 'lib/payment_day.rb', line 130

def initialize(views, options)
  @views = []
  years = View.create(views, options).years
  years = years.each_slice(options[:columns])
  years.each_with_index do |years_chunk, page|
    year_options = options.dup
    year_options[:page] = page.next
    year_options[:pages] = years.to_a.length
    @views.push(View.create(years_chunk, year_options))
  end
end

Instance Attribute Details

#viewsObject (readonly)

Returns the value of attribute views.



128
129
130
# File 'lib/payment_day.rb', line 128

def views
  @views
end

Instance Method Details



142
143
144
# File 'lib/payment_day.rb', line 142

def print
  @views.each { |view| puts view.list }
end