Class: String

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

Instance Method Summary collapse

Instance Method Details

#xb_escapeObject



4
5
6
# File 'lib/apimode/frame/frame.rb', line 4

def xb_escape
  self.gsub(/[\176\175\021\023]/) { |c| [0x7D, c[0].ord ^ 0x20].pack("CC")}
end

#xb_unescapeObject



7
8
9
# File 'lib/apimode/frame/frame.rb', line 7

def xb_unescape
  self.gsub(/\175./) { |ec| [ec.unpack("CC").last ^ 0x20].pack("C")}
end