Class: ExportCsv::MapExportFieldsService
- Inherits:
-
BaseService
- Object
- BaseService
- ExportCsv::MapExportFieldsService
- Defined in:
- app/services/export_csv/map_export_fields_service.rb
Constant Summary
Constants inherited from BaseService
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(fields, data) ⇒ MapExportFieldsService
constructor
A new instance of MapExportFieldsService.
- #invalid_fields ⇒ Object
Methods inherited from BaseService
Constructor Details
#initialize(fields, data) ⇒ MapExportFieldsService
Returns a new instance of MapExportFieldsService.
7 8 9 10 |
# File 'app/services/export_csv/map_export_fields_service.rb', line 7 def initialize(fields, data) @fields = fields @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'app/services/export_csv/map_export_fields_service.rb', line 5 def data @data end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
5 6 7 |
# File 'app/services/export_csv/map_export_fields_service.rb', line 5 def fields @fields end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 |
# File 'app/services/export_csv/map_export_fields_service.rb', line 12 def execute return data if fields.empty? selected_fields_to_hash end |
#invalid_fields ⇒ Object
18 19 20 |
# File 'app/services/export_csv/map_export_fields_service.rb', line 18 def invalid_fields fields.reject { |field| permitted_field?(field) } end |