Class: Ryodo::RuleSet

Inherits:
Object
  • Object
show all
Defined in:
lib/ryodo/rule_set.rb

Instance Method Summary collapse

Constructor Details

#initializeRuleSet

Returns a new instance of RuleSet.



3
4
5
6
# File 'lib/ryodo/rule_set.rb', line 3

def initialize
  @tree = {}
  build
end

Instance Method Details

#match(path) ⇒ Object



8
9
10
11
12
13
# File 'lib/ryodo/rule_set.rb', line 8

def match(path)
  suffix, domain, match = find_match_parts(path, [], [], nil)
  suffix.push(domain.shift) if match && !match.exception
  # only if match has no children with domain and domain is present
  [suffix, [domain.shift], domain] if match && domain[0] && !match.children.keys.include?(domain[0])
end