class EasyExport::ExportConfig
These are the DSL methods available within the `exportable` block
Attributes
partial[RW]
Public Instance Methods
fields(val = nil)
click to toggle source
# File lib/easy_export.rb, line 45 def fields(val = nil) val.nil? ? @fields : @fields = build_fields(val) end
scope(val = nil)
click to toggle source
# File lib/easy_export.rb, line 41 def scope(val = nil) val.nil? ? @scope : @scope = val end
Private Instance Methods
build_fields(fields)
click to toggle source
Providing fields as an array let's us maintain the ordering
# File lib/easy_export.rb, line 52 def build_fields(fields) raise ArgumentError, "fields must be an array" unless fields.is_a? Array ActiveSupport::OrderedHash.new.tap do |hash| fields.each do |header, value_proc| hash[header] = value_proc end end end