Class: ConfigTemplates::Criteria::Composite
- Inherits:
-
Object
- Object
- ConfigTemplates::Criteria::Composite
- Defined in:
- lib/config_templates/criteria/composite.rb
Instance Method Summary collapse
-
#initialize(*criteria) ⇒ Composite
constructor
A new instance of Composite.
- #matches?(target) ⇒ Boolean
Constructor Details
#initialize(*criteria) ⇒ Composite
Returns a new instance of Composite.
3 4 5 |
# File 'lib/config_templates/criteria/composite.rb', line 3 def initialize(*criteria) @criteria = criteria end |
Instance Method Details
#matches?(target) ⇒ Boolean
7 8 9 10 11 |
# File 'lib/config_templates/criteria/composite.rb', line 7 def matches?(target) @criteria.inject(false) do |result, criteria| result || criteria.matches?(target) end end |