Sha256: ca77d7f806983e4de3b467f7850fe529ce51436574372a4d5fa02b46174bce14
Contents?: true
Size: 674 Bytes
Versions: 2
Compression:
Stored size: 674 Bytes
Contents
module Xporter class Exporter module Transform extend ActiveSupport::Concern included do class_attribute :_record_transform, instance_accessor: false end class_methods do def transform(&block) raise 'Block must accept two arguments' unless block.arity == 2 self._record_transform = block end end def context=(options={}) @_record_context = options end private def transform(record) self.class._record_transform.call(record, @_record_context) end def transform? self.class._record_transform.present? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xporter-0.2.0 | lib/xporter/exporter/transform.rb |
xporter-0.1.0 | lib/xporter/exporter/transform.rb |