Class representing a filter used to encode and decode data written into hexadecimal.
Decodes given data writen into upcase hexadecimal representation.
string |
The data to decode. |
# File lib/origami/filters/ascii.rb, line 53 def decode(string) input = string.include?(>>) ? string[0..string.index(>>) - 1] : string digits = input.delete(" \f\t\r\n\00"").split(/(..)/).delete_if{|digit| digit.empty?} if not digits.all? { |d| d =~ /[a-fA-F0-9]{1,2}/ } raise InvalidASCIIHexStringError, input end digits.pack("H2" * digits.size) end
Generated with the Darkfish Rdoc Generator 2.