Class Matcher
In: lib/more/facets/matcher.rb
Parent: Object

Matcher

 Matcher derives from Ruby Quiz #103, the DictionaryMatcher quiz.

Methods

<<   ===   =~   add   include?   inspect   match   new   scan  

Classes and Modules

Class Matcher::MatchData

Attributes

word_count  [R] 

Public Class methods

Create a DictionaryMatcher with no words in it

Public Instance methods

<<(word)

Alias for add

===(text)

Alias for #=~

Determines whether one of the words in the DictionaryMatcher is a substring of string. Returns the index of the match if found, nil if not found.

Add a word to the DictionaryMatcher

Determine whether string was previously added to the Trie.

Determine whether one of the words in the DictionaryMatcher is a substring of string. Returns a DictionaryMatcher::MatchData object if found, nil if not found.

Scans string for all occurrances of strings in the DictionaryMatcher. Overlapping matches are skipped (only the first one is yielded), and when some strings in the DictionaryMatcher are substrings of others, only the shortest match at a given position is found.

[Validate]