Sha256: e53867b16d31bb3bcb730094f019774d72d2ed2894b10e3058d3cb6315ffe3b3

Contents?: true

Size: 863 Bytes

Versions: 14

Compression:

Stored size: 863 Bytes

Contents

module CsvRowModel
  module Import
    class File
      module Validations
        extend ActiveSupport::Concern

        included do
          include ActiveModel::Validations
          include Validators::ValidateAttributes

          validate_attributes :csv
        end

        # @return [Boolean] returns true, if the file should abort reading
        def abort?
          !valid? || !!current_row_model.try(:abort?)
        end

        # @return [Boolean] returns true, if the file should skip `current_row_model`
        def skip?
          !!current_row_model.try(:skip?)
        end

        protected
        def _abort?
          abort = abort?
          run_callbacks(:abort) if abort
          abort
        end

        def _skip?
          skip = skip?
          run_callbacks(:skip) if skip
          skip
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
csv_row_model-0.3.10 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.9 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.8 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.7 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.6 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.5 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.4 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.3 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.2 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.1 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.3.0 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.2.1 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.1.1 lib/csv_row_model/import/file/validations.rb
csv_row_model-0.1.0 lib/csv_row_model/import/file/validations.rb