class Merit::RulesMatcher
Public Class Methods
new(path, action_name)
click to toggle source
# File lib/merit/rules_matcher.rb, line 3 def initialize(path, action_name) @path = path @action_name = action_name end
Public Instance Methods
any_matching?()
click to toggle source
# File lib/merit/rules_matcher.rb, line 14 def any_matching? select_from(AppBadgeRules).any? || select_from(AppPointRules).any? end
select_from(rules)
click to toggle source
# 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
Private Instance Methods
entire_path()
click to toggle source
# File lib/merit/rules_matcher.rb, line 20 def entire_path @entire_path ||= [@path, @action_name].join('#') end