Sha256: d5365ec87df5c85a27c9706ba873e20caf094f99e2c3f18fa0517cce270606c1

Contents?: true

Size: 811 Bytes

Versions: 10

Compression:

Stored size: 811 Bytes

Contents

class ReportFilter
  attr_accessor :title
  attr_reader :start_on
  attr_reader :end_on
  attr_reader :page_size
  
  def initialize(attributes)
    @start_on = Date.civil(2007, 01, 01)
    @end_on = Date.today
    @page_size = 1000

    if attributes
      attributes = attributes.clone
      
      start_on_param = attributes.delete(:start_on)
      @start_on = Date.parse(start_on_param) if start_on_param && start_on_param.size > 0
      
      end_on_param = attributes.delete(:end_on)
      @end_on = Date.parse(end_on_param) if end_on_param && end_on_param.size > 0
      
      page_size_param = attributes.delete(:page_size)
      @page_size = page_size_param.to_i if page_size_param.to_i > 0
      
      raise "Unknown parameters: #{attributes.inspect}" unless attributes.empty?
    end
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
backlog-0.23.0 app/models/report_filter.rb
backlog-0.23.1 app/models/report_filter.rb
backlog-0.24.0 app/models/report_filter.rb
backlog-0.25.0 app/models/report_filter.rb
backlog-0.26.0 app/models/report_filter.rb
backlog-0.28.0 app/models/report_filter.rb
backlog-0.29.0 app/models/report_filter.rb
backlog-0.31.0 app/models/report_filter.rb
backlog-0.30.0 app/models/report_filter.rb
backlog-0.31.1 app/models/report_filter.rb