Sha256: da438994ee81d8f4edbef886c6c2b24a5806f275deb0a98643eb5fb3f5ebf0b4
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 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 # @api private def [](name) repositories.fetch(name) end # @api private def respond_to_missing?(name, include_private = false) repositories.key?(name) || super end private # @api private def method_missing(name, *args, &block) if repositories.key?(name) repositories[name] else super end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rom-0.4.2 | lib/rom/env.rb |
rom-0.4.1 | lib/rom/env.rb |
rom-0.4.0 | lib/rom/env.rb |