Module: Exportable::Utils
- Defined in:
- lib/exportable/utils.rb
Overview
Utiity methods used for gem
Instance Method Summary collapse
-
#get_export_options(model, options) ⇒ Object
Compute exportable options after overriding preferences.
Instance Method Details
#get_export_options(model, options) ⇒ Object
Compute exportable options after overriding preferences
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/exportable/utils.rb', line 5 def (model, ) = { only: model.attribute_names.map(&:to_sym), except: [], methods: [], header: true } = .merge() unless [:only].is_a?(Array) && [:except].is_a?(Array) && [:methods].is_a?(Array) raise ArgumentError, 'Exportable: Expecting Array type for field options' end fields = [:only] - [:except] + [:methods] { fields: fields, header: [:header] } end |