Sha256: 591e0ef0236389cc959b6f18d56770af8f80f1ca20e5f08599ed49ec7ddae0ed

Contents?: true

Size: 533 Bytes

Versions: 10

Compression:

Stored size: 533 Bytes

Contents

module CsvImportMagic
  module Models
    def csv_import_magic(options)
      define_method(:csv_parser_names) do
        names_of_parsers = {}

        options.each do |key, _value|
          names_of_parsers["#{key}_parser"] = "#{key.to_s.classify}Parser".constantize
        end

        names_of_parsers
      end

      define_singleton_method(:csv_parser_default_name) { "#{name.to_s.underscore}_parser" }
      define_singleton_method(:columns_names) { |param| options[param.to_s.remove('_parser').to_sym] }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
csv_import_magic-0.0.11 lib/csv_import_magic/models.rb
csv_import_magic-0.0.10 lib/csv_import_magic/models.rb
csv_import_magic-0.0.8 lib/csv_import_magic/models.rb
csv_import_magic-0.0.7 lib/csv_import_magic/models.rb
csv_import_magic-0.0.6 lib/csv_import_magic/models.rb
csv_import_magic-0.0.5 lib/csv_import_magic/models.rb
csv_import_magic-0.0.4 lib/csv_import_magic/models.rb
csv_import_magic-0.0.3 lib/csv_import_magic/models.rb
csv_import_magic-0.0.2 lib/csv_import_magic/models.rb
csv_import_magic-0.0.1 lib/csv_import_magic/models.rb