Permalink
Browse files

Added case-equality for Citrus::Rule

  • Loading branch information...
1 parent bb7179b commit 9d326307e5a47d0bbe9b26b07b8c46ddaddfc824 @mjackson committed Mar 17, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/citrus.rb
View
@@ -648,6 +648,11 @@ def test(string, options={})
nil
end
+ # Tests the given +obj+ for case equality with this rule.
+ def ===(obj)
+ !test(obj).nil?
+ end
+
# Returns +true+ if this rule is a Terminal.
def terminal?
false
@@ -700,6 +705,8 @@ def ==(other)
end
end
+ alias_method :eql?, :==
+
def inspect # :nodoc:
to_s
end

0 comments on commit 9d32630

Please sign in to comment.