Class: String

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

Instance Method Summary collapse

Instance Method Details

#from_hex_strObject



51
52
53
54
55
56
# File 'lib/rublicatorg.rb', line 51

def from_hex_str
  data = self.split(' ')
  str = ""
  data.each{|h| eval "str += '%c' % #{h}"}
  str
end

#to_hex_arrayObject



45
46
47
48
49
# File 'lib/rublicatorg.rb', line 45

def to_hex_array
  arr = []
  self.each_byte {|b| arr << '0x%02x' % b}
  arr
end

#to_hex_strObject



39
40
41
42
43
# File 'lib/rublicatorg.rb', line 39

def to_hex_str
  str = ""
  self.each_byte {|b| str << '0x%02x ' % b}
  str.strip
end