Class: ConvenientService::Support::DependencyContainer::Entities::MethodCollection
- Inherits:
-
Object
- Object
- ConvenientService::Support::DependencyContainer::Entities::MethodCollection
- Defined in:
- lib/convenient_service/support/dependency_container/entities/method_collection.rb
Instance Method Summary collapse
- #<<(method) ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
- #==(other) ⇒ Boolean?
- #clear ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
- #empty? ⇒ Boolean
- #find_by(name: Support::NOT_PASSED, slug: Support::NOT_PASSED, scope: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Method?
- #include?(method) ⇒ Boolean
- #initialize(methods: []) ⇒ void constructor
- #to_a ⇒ Array
Constructor Details
#initialize(methods: []) ⇒ void
12 13 14 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 12 def initialize(methods: []) @methods = methods end |
Instance Method Details
#<<(method) ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
38 39 40 41 42 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 38 def <<(method) methods << method self end |
#==(other) ⇒ Boolean?
79 80 81 82 83 84 85 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 79 def ==(other) return unless other.instance_of?(self.class) return false if methods != other.methods true end |
#clear ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
62 63 64 65 66 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 62 def clear methods.clear self end |
#empty? ⇒ Boolean
47 48 49 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 47 def empty? methods.empty? end |
#find_by(name: Support::NOT_PASSED, slug: Support::NOT_PASSED, scope: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Method?
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 22 def find_by(name: Support::NOT_PASSED, slug: Support::NOT_PASSED, scope: Support::NOT_PASSED) rules = [] rules << ->(method) { method.name.to_s == name.to_s } if name != Support::NOT_PASSED rules << ->(method) { method.slug.to_s == slug.to_s } if slug != Support::NOT_PASSED rules << ->(method) { method.scope == scope } if scope != Support::NOT_PASSED condition = Utils::Proc.conjunct(rules) methods.find(&condition) end |
#include?(method) ⇒ Boolean
55 56 57 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 55 def include?(method) methods.include?(method) end |
#to_a ⇒ Array
71 72 73 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 71 def to_a methods.to_a end |