Sha256: bd838dca13aa2eb35d6a7630c56359dd9769fc1952dcb37d8f1e2ffe59db35c7

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

require 'csv_row_model/concerns/attributes_base'
require 'csv_row_model/internal/export/attribute'

module CsvRowModel
  module Export
    module Attributes
      extend ActiveSupport::Concern
      include AttributesBase

      included do
        ensure_attribute_method
      end

      def attribute_objects
        @attribute_objects ||= array_to_block_hash(self.class.column_names) { |column_name| Attribute.new(column_name, self) }
      end

      class_methods do
        protected
        def define_attribute_method(column_name)
          super { source_model.public_send(column_name) }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta2 lib/csv_row_model/concerns/export/attributes.rb