Class: FuzzyMatch::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/fuzzy_match/rule.rb,
lib/fuzzy_match/rule/grouping.rb,
lib/fuzzy_match/rule/identity.rb,
lib/fuzzy_match/rule/stop_word.rb,
lib/fuzzy_match/rule/normalizer.rb

Overview

A rule characterized by a regexp. Abstract.

Direct Known Subclasses

Grouping, Identity, Normalizer, StopWord

Defined Under Namespace

Classes: Grouping, Identity, Normalizer, StopWord

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(regexp_or_str) ⇒ Rule

Returns a new instance of Rule.



6
7
8
# File 'lib/fuzzy_match/rule.rb', line 6

def initialize(regexp_or_str)
  @regexp = regexp_or_str.to_regexp
end

Instance Attribute Details

#regexpObject (readonly)

Returns the value of attribute regexp.



4
5
6
# File 'lib/fuzzy_match/rule.rb', line 4

def regexp
  @regexp
end

Instance Method Details

#==(other) ⇒ Object



10
11
12
# File 'lib/fuzzy_match/rule.rb', line 10

def ==(other)
  regexp == other.regexp
end