Sha256: ec1354d1a051454da4483438af155547731d1ab0bae402e1e8de9bb5f0d34442

Contents?: true

Size: 712 Bytes

Versions: 5

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

require "csvbuilder/core/internal/attribute_base"

module Csvbuilder
  module Import
    class Attribute < Csvbuilder::AttributeBase
      attr_reader :source_value, :attribute_errors

      def initialize(column_name, source_value, attribute_errors, row_model)
        @source_value     = source_value
        @attribute_errors = attribute_errors || []

        super(column_name, row_model)
      end

      def value
        @value ||= if attribute_errors.present?
                     nil
                   else
                     formatted_value
                   end
      end

      def parsed_value
        @parsed_value ||= formatted_value
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
csvbuilder-importer-0.1.5.1 lib/csvbuilder/importer/internal/import/attribute.rb
csvbuilder-importer-0.1.5 lib/csvbuilder/importer/internal/import/attribute.rb
csvbuilder-importer-0.1.4 lib/csvbuilder/importer/internal/import/attribute.rb
csvbuilder-importer-0.1.3 lib/csvbuilder/importer/internal/import/attribute.rb
csvbuilder-importer-0.1.2 lib/csvbuilder/importer/internal/import/attribute.rb