Sha256: fe5cf187337a006517d79db278a29599598ad947c4a558a5e6a42f176040c884
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Dry module Core class Container # Create a namespace to be imported # # @example # # ns = Dry::Core::Container::Namespace.new('name') do # register('item', 'item') # end # # container = Dry::Core::Container.new # # container.import(ns) # # container.resolve('name.item') # => 'item' # # # @api public class Namespace # @return [Mixed] The namespace (name) attr_reader :name # @return [Proc] The block to be executed when the namespace is imported attr_reader :block # Create a new namespace # # @param [Mixed] name # The name of the namespace # @yield # The block to evaluate when the namespace is imported # # @return [Dry::Core::Container::Namespace] # # @api public def initialize(name, &block) @name = name @block = block end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dry-core-1.0.2 | lib/dry/core/container/namespace.rb |
dry-core-1.0.1 | lib/dry/core/container/namespace.rb |
dry-core-1.0.0 | lib/dry/core/container/namespace.rb |