Class: WorksReportFilter

Inherits:
ReportFilter show all
Defined in:
app/models/works_report_filter.rb

Instance Attribute Summary collapse

Attributes inherited from ReportFilter

#end_on, #page_size, #start_on, #title

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ WorksReportFilter

Returns a new instance of WorksReportFilter.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/works_report_filter.rb', line 6

def initialize(attributes)
  @project_id = nil
  @invoice = nil
  @user_id = nil

  if attributes
    attributes = attributes.clone
    
    project_id_param = attributes.delete(:project_id)
    @project_id = project_id_param.to_i if project_id_param && project_id_param.size > 0
    
    invoice_param = attributes.delete(:invoice)
    @invoice = invoice_param == 'true' if invoice_param && invoice_param.size > 0
    
    user_id_param = attributes.delete(:user_id)
    @user_id = user_id_param.to_i if user_id_param && user_id_param.size > 0
    
  end
  super(attributes)
end

Instance Attribute Details

#invoiceObject (readonly)

Returns the value of attribute invoice.



3
4
5
# File 'app/models/works_report_filter.rb', line 3

def invoice
  @invoice
end

#project_idObject (readonly)

Returns the value of attribute project_id.



2
3
4
# File 'app/models/works_report_filter.rb', line 2

def project_id
  @project_id
end

#user_idObject (readonly)

Returns the value of attribute user_id.



4
5
6
# File 'app/models/works_report_filter.rb', line 4

def user_id
  @user_id
end