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
17 18 19 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 17 def initialize(methods: []) @methods = methods end |
Instance Method Details
#<<(method) ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
43 44 45 46 47 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 43 def <<(method) methods << method self end |
#==(other) ⇒ Boolean?
84 85 86 87 88 89 90 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 84 def ==(other) return unless other.instance_of?(self.class) return false if methods != other.methods true end |
#clear ⇒ ConvenientService::Support::DependencyContainer::Entities::MethodCollection
67 68 69 70 71 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 67 def clear methods.clear self end |
#empty? ⇒ Boolean
52 53 54 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 52 def empty? methods.empty? end |
#find_by(name: Support::NOT_PASSED, slug: Support::NOT_PASSED, scope: Support::NOT_PASSED) ⇒ ConvenientService::Support::DependencyContainer::Entities::Method?
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 27 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 } unless Support::NOT_PASSED[name] rules << ->(method) { method.slug.to_s == slug.to_s } unless Support::NOT_PASSED[slug] rules << ->(method) { method.scope == scope } unless Support::NOT_PASSED[scope] condition = Utils::Proc.conjunct(rules) methods.find(&condition) end |
#include?(method) ⇒ Boolean
60 61 62 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 60 def include?(method) methods.include?(method) end |
#to_a ⇒ Array
76 77 78 |
# File 'lib/convenient_service/support/dependency_container/entities/method_collection.rb', line 76 def to_a methods.to_a end |