Module: YiffSpace::Extensions::String::Sql
- Included in:
- String
- Defined in:
- lib/yiffspace/extensions/string/sql.rb
Instance Method Summary collapse
Instance Method Details
#to_escaped_for_sql_like ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/yiffspace/extensions/string/sql.rb', line 7 def to_escaped_for_sql_like gsub(/%|_|\*|\\\*|\\\\|\\/) do |str| case str when "%" then '\%' when "_" then '\_' when "*" then "%" when '\*' then "*" when "\\\\", "\\" then "\\\\" end end end |