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
12 13 14 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 12 def initialize(namespaces: []) @namespaces = namespaces end |
Instance Method Details
#<<(namespace) ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
34 35 36 37 38 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 34 def <<(namespace) namespaces << namespace self end |
#==(other) ⇒ Boolean
75 76 77 78 79 80 81 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 75 def ==(other) return unless other.instance_of?(self.class) return false if namespaces != other.namespaces true end |
#clear ⇒ ConvenientService::Support::DependencyContainer::Entities::NamespaceCollection
58 59 60 61 62 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 58 def clear namespaces.clear self end |
#empty? ⇒ Boolean
43 44 45 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 43 def empty? namespaces.empty? end |
#find_by(name: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Namespace?
20 21 22 23 24 25 26 27 28 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 20 def find_by(name: Support::NOT_PASSED) rules = [] rules << ->(namespace) { namespace.name.to_s == name.to_s } if name != Support::NOT_PASSED condition = Utils::Proc.conjunct(rules) namespaces.find(&condition) end |
#include?(namespace) ⇒ Boolean
51 52 53 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 51 def include?(namespace) namespaces.include?(namespace) end |
#to_a ⇒ Array
67 68 69 |
# File 'lib/convenient_service/support/dependency_container/entities/namespace_collection.rb', line 67 def to_a namespaces.to_a end |