Class: ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
- Inherits:
-
Object
- Object
- ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
- Defined in:
- lib/convenient_service/support/dependency_container/entities/namespace_collection.rb
Instance Method Summary collapse
- #<<(namespace) ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
- #==(other) ⇒ Boolean?
- #clear ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
- #empty? ⇒ Boolean
- #find_by(name: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Namespace?
- #include?(namespace) ⇒ Boolean
- #initialize(namespaces: []) ⇒ void constructor
- #to_a ⇒ Array
Constructor Details
#initialize(namespaces: []) ⇒ void
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
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?
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 |
#clear ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
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
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?
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
56 57 58 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 56 def include?(namespace) namespaces.include?(namespace) end |
#to_a ⇒ Array
72 73 74 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 72 def to_a namespaces.to_a end |