lib/facet/regexp/arity.rb in facets-0.7.2 vs lib/facet/regexp/arity.rb in facets-0.9.0

- old
+ new

@@ -1,14 +2 @@ -class Regexp - # Returns the number of backreferencing subexpressions. - # - # require 'facet/regexp/arity' - # - # /(a)(b)(c)/.arity #=> 3 - # /(a(b(c)))/.arity #=> 3 - # - # Note: This is not perfect, especially with regards to \x - # and embedded comments. - def arity - self.source.scan( /(?!\\)[(](?!\?[#=:!>-imx])/ ).length - end -end +require 'nano/regexp/arity.rb' \ No newline at end of file