Sha256: 5f9bf34839caef677966abde7aa858be09d09d0dc0db3255577d8908792128ca

Contents?: true

Size: 1.49 KB

Versions: 17

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Support
    module DependencyContainer
      module Entities
        class Namespace
          ##
          # @!attribute [r] name
          #   @return [String, Symbol]
          #
          attr_reader :name

          ##
          # @param name [String, Symbol]
          # @return [void]
          #
          def initialize(name:)
            @name = name
          end

          ##
          # @return [Proc]
          #
          def body
            @body ||= -> { namespace }
          end

          ##
          # @return [ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection]
          #
          def namespaces
            @namespaces ||= Entities::NamespaceCollection.new
          end

          ##
          # @param name [String, Symbol]
          # @param body [Proc]
          # @return [Symbol]
          #
          def define_method(name, &body)
            define_singleton_method(name, &body)
          end

          ##
          # @param other [Object] Can be any type.
          # @return [Boolean]
          #
          def ==(other)
            return unless other.instance_of?(self.class)

            return false if name != other.name

            true
          end

          private

          ##
          # @return [ConvenientService::Support::DependencyContainer::Entities::Namespace]
          #
          def namespace
            self
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.19.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.18.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.17.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.16.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.15.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.14.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.13.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.12.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.11.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.10.1 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.10.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.9.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.8.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.7.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.6.0 lib/convenient_service/support/dependency_container/entities/namespace.rb
convenient_service-0.5.0 lib/convenient_service/support/dependency_container/entities/namespace.rb