Added String#read_ber!
This commit is contained in:
parent
4db9f2c7cc
commit
4b110ff886
|
@ -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
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue