Sha256: 4097250cffdd3501df9866e7f2dfd628850864338ca80146ce812de98318038f

Contents?: true

Size: 372 Bytes

Versions: 1

Compression:

Stored size: 372 Bytes

Contents

module ROM
  # @private
  class MapperRegistry < Registry
    # @api private
    def []=(name, mapper)
      elements[name] = mapper
    end

    # @api private
    def by_path(path)
      elements[paths(path).detect { |name| elements.key?(name) }]
    end

    private

    # @api private
    def paths(path)
      path.split('.').map(&:to_sym).reverse
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-0.5.0 lib/rom/mapper_registry.rb