Sha256: 1e3583cfa6aebbcf11049970268fa63064a1023fb1b3e2c0cc8341c6ca27804d
Contents?: true
Size: 558 Bytes
Versions: 24
Compression:
Stored size: 558 Bytes
Contents
require_relative './shared' str = 'Lorem ipsum et dolorem' rx = /\S/ cs = CharacterSet.whitespace.inversion benchmark( caption: 'Detecting non-whitespace', cases: { 'Regexp#match?' => -> { rx.match?(str) }, 'CharacterSet#cover?' => -> { cs.cover?(str) }, } ) str = 'Lorem ipsum et dolorem' rx = /[^a-z]/i cs = CharacterSet.new('A'..'Z') + CharacterSet.new('a'..'z') benchmark( caption: 'Detecting non-letters', cases: { 'Regexp#match?' => -> { rx.match?(str) }, 'CharacterSet#cover?' => -> { cs.cover?(str) }, } )
Version data entries
24 entries across 24 versions & 1 rubygems