Class: Merit::RulesMatcher
- Inherits:
-
Object
- Object
- Merit::RulesMatcher
- Defined in:
- lib/merit/rules_matcher.rb
Instance Method Summary collapse
- #any_matching? ⇒ Boolean
-
#initialize(path, action_name) ⇒ RulesMatcher
constructor
A new instance of RulesMatcher.
- #select_from(rules) ⇒ Object
Constructor Details
#initialize(path, action_name) ⇒ RulesMatcher
Returns a new instance of RulesMatcher.
3 4 5 6 |
# File 'lib/merit/rules_matcher.rb', line 3 def initialize(path, action_name) @path = path @action_name = action_name end |
Instance Method Details
#any_matching? ⇒ Boolean
14 15 16 |
# File 'lib/merit/rules_matcher.rb', line 14 def any_matching? select_from(AppBadgeRules).any? || select_from(AppPointRules).any? end |
#select_from(rules) ⇒ Object
8 9 10 11 12 |
# File 'lib/merit/rules_matcher.rb', line 8 def select_from(rules) rules.select do |glob, _| entire_path =~ /^#{Regexp.new(glob)}$/ end.values.flatten end |