Class: Fixnum

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

Instance Method Summary collapse

Instance Method Details

#xchr(escape = true) ⇒ Object



415
416
417
418
419
420
421
422
423
424
# File 'lib/gorp/commands.rb', line 415

def xchr(escape=true)
  n = XChar::CP1252[self] || self
  case n
  when 0x9, 0xA, 0xD, (0x20..0xD7FF), (0xE000..0xFFFD), (0x10000..0x10FFFF)
    XChar::PREDEFINED[n] or 
      (n<128 ? n.chr : (escape ? "&##{n};" : [n].pack('U*')))
  else
    '*'
  end
end