Added String#read_ber!

This commit is contained in:
blackhedd 2006-11-27 23:09:18 +00:00
parent 4db9f2c7cc
commit 4b110ff886

View file

@ -277,13 +277,23 @@ rescue LoadError
# IO so we'd pick it up above. But you'd be wrong.
end
class String
include Net::BER::BERParser
def read_ber syntax=nil
StringIO.new(self).read_ber(syntax)
end
def read_ber! syntax=nil
obj,n_consumed = read_ber_from_string(self, syntax)
if n_consumed
self.slice!(0...n_consumed)
obj
else
nil
end
end
end
#----------------------------------------------