Class: Report::CostCenter::CostCenterCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/cost_center/cost_center_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yearsArray<Integer>

Years.

Returns:

  • (Array<Integer>)


32
33
34
# File 'app/services/report/cost_center/cost_center_command.rb', line 32

def self.years
  (2012..Date.current.year).to_a
end

Instance Method Details

#executeObject

Run the report with the given filters and store the result.

Returns:

  • (Object)


10
11
12
13
14
# File 'app/services/report/cost_center/cost_center_command.rb', line 10

def execute
  return unless valid?

  @result = Report::CostCenter::CostCenter.result_report(attributes)
end