lib/arugula.rb in arugula-0.3.0 vs lib/arugula.rb in arugula-0.4.0
- old
+ new
@@ -17,10 +17,11 @@
end
def match(str, index = 0)
match_data = MatchData.new(self, str)
loop do
+ match_data.reset_captures!
match, end_index = @root.match(str, index, match_data)
if match
match_data.start_index = index
match_data.end_index = end_index
return match_data.freeze
@@ -30,7 +31,18 @@
end
end
def to_s
"/#{@root}/"
+ end
+
+ alias inspect to_s
+
+ def hash
+ to_s.hash
+ end
+
+ def ==(other)
+ return false unless other.is_a?(Arugula) || other.is_a?(Regexp)
+ inspect == other.inspect
end
end