Sha256: 8fb0795c333139e97c3bcf107cde6dfba3f6f7527ffaff3d170997f2fb5e1153

Contents?: true

Size: 868 Bytes

Versions: 13

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    module Import
      module Readers
        # Abstract class with a very naive default implementation. Each importable
        # file type should have it's own reader.
        class Base
          def initialize(file)
            @file = file
          end

          # The read_rows method should iterate over each row of the data and
          # yield the data array of each row with the row's index.
          # The first row yielded with index 0 needs to contain the data headers
          # which can be later used to map the data to correct attributes.
          #
          # This needs to be implemented by the extending classes.
          def read_rows
            raise NotImplementedError
          end

          protected

          attr_reader :file
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-admin-0.25.2 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.1 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.0 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.0.rc4 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.0.rc3 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.0.rc2 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.25.0.rc1 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.3 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.2 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.1 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.0 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.0.rc2 lib/decidim/admin/import/readers/base.rb
decidim-admin-0.24.0.rc1 lib/decidim/admin/import/readers/base.rb