Class: Appydave::Tools::Jump::Commands::Report
- Defined in:
- lib/appydave/tools/jump/commands/report.rb
Overview
Report command generates various reports about locations
Constant Summary collapse
- VALID_REPORTS =
%w[ categories brands clients types tags by-brand by-client by-type by-tag summary ].freeze
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#report_type ⇒ Object
readonly
Returns the value of attribute report_type.
-
#skip_unassigned ⇒ Object
readonly
Returns the value of attribute skip_unassigned.
Attributes inherited from Base
#config, #options, #path_validator
Instance Method Summary collapse
-
#initialize(config, report_type, **options) ⇒ Report
constructor
A new instance of Report.
- #run ⇒ Object
Constructor Details
#initialize(config, report_type, **options) ⇒ Report
Returns a new instance of Report.
17 18 19 20 21 22 23 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 17 def initialize(config, report_type, **) super(config, path_validator: [:path_validator] || PathValidator.new, **) @report_type = report_type @filter = [:filter] @limit = [:limit] @skip_unassigned = .fetch(:skip_unassigned, true) end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
15 16 17 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 15 def filter @filter end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
15 16 17 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 15 def limit @limit end |
#report_type ⇒ Object (readonly)
Returns the value of attribute report_type.
15 16 17 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 15 def report_type @report_type end |
#skip_unassigned ⇒ Object (readonly)
Returns the value of attribute skip_unassigned.
15 16 17 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 15 def skip_unassigned @skip_unassigned end |
Instance Method Details
#run ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/appydave/tools/jump/commands/report.rb', line 25 def run unless VALID_REPORTS.include?(report_type) return error_result( "Unknown report type: #{report_type}", code: 'INVALID_INPUT', suggestion: "Valid types: #{VALID_REPORTS.join(', ')}" ) end send("report_#{report_type.gsub('-', '_')}") end |