Sha256: 6d8007fdef0651cfc0eb590d49697516ec726d9c373efba9e90f0e7747242952
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
module CsvRowModel module Import class File module Validations extend ActiveSupport::Concern include ActiveWarnings include Validators::ValidateAttributes included do validate_attributes :csv warnings do validate { errors.add(:csv, "has header with #{csv.header.message}") unless csv.header.class == Array } end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csv_row_model-1.0.0.beta1 | lib/csv_row_model/import/file/validations.rb |