Sha256: faf89d082d236db6cf88903c399f14facbd21b2314d0ff941b3e62bfc994e045

Contents?: true

Size: 228 Bytes

Versions: 2

Compression:

Stored size: 228 Bytes

Contents

class String

  @@chars ||= ('a'..'z').to_a + ('A'..'Z').to_a

  def self.random(size = 8)
    (0..size).map{ @@chars[rand(@@chars.length)] }.join
  end

  def sanitize_sql!
    self.gsub(/\\/, '\&\&').gsub(/'/, "''")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cartoset-0.0.2 spec/support/string_extension.rb
cartoset-0.0.1 spec/support/string_extension.rb