Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mylibs.rb

Direct Known Subclasses

DetailWin::HtmlStr

Instance Method Summary collapse

Instance Method Details

#_chomp_nullObject



455
456
457
# File 'lib/mylibs.rb', line 455

def _chomp_null
    gsub(/\0.*/, '')
end

#double_quoteObject Also known as: dquote



445
446
447
# File 'lib/mylibs.rb', line 445

def double_quote
    '"' + self + '"'
end

#single_quoteObject Also known as: squote



450
451
452
# File 'lib/mylibs.rb', line 450

def single_quote
    "'" + self + "'"
end

#sql_escapeObject



465
466
467
468
# File 'lib/mylibs.rb', line 465

def sql_escape
    str = _chomp_null
    str.gsub(/\\/, '\&\&').gsub(/'/, "''")    #'
end

#sql_quoteObject



459
460
461
462
463
# File 'lib/mylibs.rb', line 459

def sql_quote
    str = _chomp_null
    return 'NULL' if str.empty?
    "'#{str.sql_escape}'"
end