Class: FuzzyMatch::Rule
- Inherits:
-
Object
- Object
- FuzzyMatch::Rule
- Defined in:
- lib/fuzzy_match/rule.rb,
lib/fuzzy_match/rule/grouping.rb,
lib/fuzzy_match/rule/identity.rb
Overview
A rule characterized by a regexp. Abstract.
Defined Under Namespace
Instance Attribute Summary collapse
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(regexp) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(regexp) ⇒ Rule
Returns a new instance of Rule.
6 7 8 9 10 11 |
# File 'lib/fuzzy_match/rule.rb', line 6 def initialize(regexp) unless regexp.is_a?(::Regexp) raise ArgumentError, "[FuzzyMatch] Rules must be set with Regexp objects, but got #{regexp.inspect} (#{regexp.class.name})" end @regexp = regexp end |
Instance Attribute Details
#regexp ⇒ Object (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
13 14 15 |
# File 'lib/fuzzy_match/rule.rb', line 13 def ==(other) other.class == self.class and regexp == other.regexp end |