Class: ConvenientService::Support::DependencyContainer::Entities::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/support/dependency_container/entities/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ void

Parameters:

  • name (String, Symbol)


18
19
20
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 18

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 12

def name
  @name
end

Instance Method Details

#==(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


49
50
51
52
53
54
55
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 49

def ==(other)
  return unless other.instance_of?(self.class)

  return false if name != other.name

  true
end

#bodyProc

Returns:

  • (Proc)


25
26
27
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 25

def body
  @body ||= -> { namespace }
end

#define_method(name, &body) ⇒ Symbol

Parameters:

  • name (String, Symbol)
  • body (Proc)

Returns:

  • (Symbol)


41
42
43
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 41

def define_method(name, &body)
  define_singleton_method(name, &body)
end

#namespacesConvenientService::Support::DependencyContainer::Entities::NamespaceCollection



32
33
34
# File 'lib/convenient_service/support/dependency_container/entities/namespace.rb', line 32

def namespaces
  @namespaces ||= Entities::NamespaceCollection.new
end