Sha256: 76206690a006560b460d43217680ba69068975a39c0e113eadaf9fa52a9f5393

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module SpeakyCsv
  # An instance of this class is yielded to the block passed to
  # define_csv_fields. Used to configure speaky csv.
  class Config
    attr_accessor \
      :export_only_fields,
      :fields,
      :has_manys,
      :has_ones,
      :primary_key,
      :root

    def initialize(root: true)
      @root = root
      @export_only_fields = []
      @fields = []
      @has_manys = {}
      @has_ones = {}
      @primary_key = :id
    end

    def dup
      other = super
      other.instance_variable_set '@has_manys', @has_manys.deep_dup
      other.instance_variable_set '@has_ones', @has_ones.deep_dup

      other
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
speaky_csv-0.0.5 lib/speaky_csv/config.rb