Sha256: 37d0a4c6876eab3b144d048a6514478f1767d70e06b658298c3f2fb16b89da98

Contents?: true

Size: 486 Bytes

Versions: 3

Compression:

Stored size: 486 Bytes

Contents

module Materialize
  class BaseBuilder
    extend Concurrent
    class << self

      def build(data, repo, options)
        entity_class.new(data)
      end

      def build_all(data, repo, options)
        entity_class.wrap(data)
      end

      def entity_class
        "Entities::#{entity_base_class_name}".split('::').reduce(Module, :const_get)
      end

      private

      def entity_base_class_name
        "#{self.name[0..-8]}".split('::').last
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
materialize-0.2.6 lib/materialize/base_builder.rb
materialize-0.2.5 lib/materialize/base_builder.rb
materialize-0.2.4 lib/materialize/base_builder.rb