Class: ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(namespaces: []) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 1.0.0



17
18
19
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 17

def initialize(namespaces: [])
  @namespaces = namespaces
end

Instance Method Details

#<<(namespace) ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def <<(namespace)
  namespaces << namespace

  self
end

#==(other) ⇒ Boolean?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)

Since:

  • 1.0.0



80
81
82
83
84
85
86
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 80

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

  return false if namespaces != other.namespaces

  true
end

#clearConvenientService::Support::DependencyContainer::Entities::NamespaceCollection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



63
64
65
66
67
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 63

def clear
  namespaces.clear

  self
end

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

Since:

  • 1.0.0



48
49
50
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 48

def empty?
  namespaces.empty?
end

#find_by(name: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Namespace?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • name (String, Symbol) (defaults to: Support::NOT_PASSED)

Returns:

Since:

  • 1.0.0



25
26
27
28
29
30
31
32
33
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 25

def find_by(name: Support::NOT_PASSED)
  rules = []

  rules << ->(namespace) { namespace.name.to_s == name.to_s } unless Support::NOT_PASSED[name]

  condition = Utils::Proc.conjunct(rules)

  namespaces.find(&condition)
end

#include?(namespace) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

  • (Boolean)

Since:

  • 1.0.0



56
57
58
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 56

def include?(namespace)
  namespaces.include?(namespace)
end

#to_aArray

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array)

Since:

  • 1.0.0



72
73
74
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 72

def to_a
  namespaces.to_a
end