Class: Cirrocumulus::Ruler::PatternMatcher
- Inherits:
-
Object
- Object
- Cirrocumulus::Ruler::PatternMatcher
- Defined in:
- lib/cirrocumulus/rules/pattern_matcher.rb
Overview
The Matcher. Matches and compares facts with each other. Searches and bind variables.
Instance Method Summary collapse
Instance Method Details
#match(pattern, fact) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cirrocumulus/rules/pattern_matcher.rb', line 6 def match(pattern, fact) return false if fact.data.size != pattern.size fact_matches = true pattern.each_with_index do |el,i| next if el.is_a?(Symbol) && el.to_s.upcase == el.to_s fact_matches = false if el != fact.data[i] end fact_matches end |