Sha256: 7fd5dc6ae0ac506a9add7293d13e94a46a2dd2f370a8b4a9be5841bd66bc89b6

Contents?: true

Size: 442 Bytes

Versions: 12

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

require 'active_support'

class DHS::Record

  # Mapping allows to configure some accessors that access data using a provided proc
  module Mapping
    extend ActiveSupport::Concern

    module ClassMethods
      def mapping
        @mapping ||= {}
      end

      def mapping=(mapping)
        @mapping = mapping
      end

      def map(name, block)
        mapping[name] = block
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dhs-1.6.0 lib/dhs/concerns/record/mapping.rb
dhs-1.5.0 lib/dhs/concerns/record/mapping.rb
dhs-1.4.2 lib/dhs/concerns/record/mapping.rb
dhs-1.4.1 lib/dhs/concerns/record/mapping.rb
dhs-1.4.0 lib/dhs/concerns/record/mapping.rb
dhs-1.3.0 lib/dhs/concerns/record/mapping.rb
dhs-1.2.0 lib/dhs/concerns/record/mapping.rb
dhs-1.1.0 lib/dhs/concerns/record/mapping.rb
dhs-1.0.3 lib/dhs/concerns/record/mapping.rb
dhs-1.0.2 lib/dhs/concerns/record/mapping.rb
dhs-1.0.1 lib/dhs/concerns/record/mapping.rb
dhs-1.0.0 lib/dhs/concerns/record/mapping.rb