Sha256: 9b1321f3027beebd045b4b00eac337d8e934d893cf28d65ba0d263ea383de257
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
module ROM # Exposes defined repositories, schema, relations and mappers # # @api public class Env include Adamantium::Flat include Equalizer.new( :repositories, :schema, :relations, :mappers, :commands ) attr_reader :repositories, :schema, :relations, :mappers, :commands # @api private def initialize(repositories, schema, relations, mappers, commands) @repositories = repositories @schema = schema @relations = relations @mappers = mappers @commands = commands end # Returns a reader with access to defined mappers # # @example # # rom.read(:users).adults.to_a # # @api public def read(name) mappers[name] end # Returns commands registry for the given relation # # @example # # rom.command(:users).create # # @api public def command(name) commands[name] end # Return repository identified by its name # # @return [Repository] # # @api private def [](name) repositories.fetch(name) end # @api private def respond_to_missing?(name, include_private = false) repositories.key?(name) || super end private # Return repository if the method matches repository name # # @return [Repository] # # @api private def method_missing(name, *args, &block) if repositories.key?(name) repositories[name] else super end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-0.5.0 | lib/rom/env.rb |