Class: Symbol
Constant Summary collapse
- HasSymbolSupport =
true
Instance Method Summary collapse
-
#=~(regexp) ⇒ Object
Warning: Due to what I think is a bug in Ruby, $1, Regexp.last_match do not yield accurate results when queried after returning from a method call that does a regexp match! If you need access to that data, you’re better off just doing :symbol.to_s =~ /regexp/ yourself.
- #match(regexp) ⇒ Object
Instance Method Details
#=~(regexp) ⇒ Object
Warning: Due to what I think is a bug in Ruby, $1, Regexp.last_match do not yield accurate results when queried after returning from a method call that does a regexp match! If you need access to that data, you’re better off just doing :symbol.to_s =~ /regexp/ yourself. If all you need is a true/false (matches or doesn’t match) result, then you can use this.
:cat =~ /c.t/
28 29 30 |
# File 'lib/qualitysmith_extensions/symbol/match.rb', line 28 def =~(regexp) to_s =~ regexp end |
#match(regexp) ⇒ Object
18 19 20 |
# File 'lib/qualitysmith_extensions/symbol/match.rb', line 18 def match(regexp) to_s.match(regexp) end |