Sha256: e7f060301005740c75d7062909c79f21cab22537ece18fb253dcec858763cd10
Contents?: true
Size: 335 Bytes
Versions: 20
Compression:
Stored size: 335 Bytes
Contents
class Regexp # Returns the number of backreferencing subexpressions. # # /(a)(b)(c)/.arity #=> 3 # /(a(b(c)))/.arity #=> 3 # # Note that this is not perfect, especially with regards to \x # and embedded comments. # # CREDIT: Trans def arity source.scan( /(?!\\)[(](?!\?[#=:!>-imx])/ ).length end end
Version data entries
20 entries across 19 versions & 2 rubygems