module PatternMatcher
Constants
- VERSION
Public Class Methods
add_pattern_hash(hash)
click to toggle source
# File lib/pattern_matcher.rb, line 50 def self.add_pattern_hash(hash) pattern = Pattern.new(hash) @patterns.add_pattern pattern if pattern.is_valid? end
configuration()
click to toggle source
# File lib/pattern_matcher.rb, line 20 def self.configuration @configuration ||= PatternMatcher::Config.new end
configure() { |configuration| ... }
click to toggle source
# File lib/pattern_matcher.rb, line 15 def self.configure yield configuration if block_given? @patterns = PatternManager.initialize_patterns end
configured?()
click to toggle source
# File lib/pattern_matcher.rb, line 24 def self.configured? !@configuration.nil? end
match_patterns_to_text(text)
click to toggle source
# File lib/pattern_matcher.rb, line 28 def self.match_patterns_to_text(text) matches = [] @patterns.to_a.each do |pattern| regex_match = Matcher.match_pattern_in_text(pattern, text) matches << Match.new({:name => pattern.name, :regex_match => regex_match}) if regex_match end matches end
patterns()
click to toggle source
# File lib/pattern_matcher.rb, line 46 def self.patterns @patterns end
proof_patterns()
click to toggle source
# File lib/pattern_matcher.rb, line 37 def self.proof_patterns pattern_errors = {} @patterns.each do |pattern| failures = pattern.validate_all_examples pattern_errors[pattern.pattern_id] = failures if (pattern.is_valid? && failures.count > 0) end pattern_errors end