Added String#read_ber!
This commit is contained in:
parent
4db9f2c7cc
commit
4b110ff886
1 changed files with 15 additions and 5 deletions
|
@ -277,14 +277,24 @@ rescue LoadError
|
|||
# IO so we'd pick it up above. But you'd be wrong.
|
||||
end
|
||||
|
||||
|
||||
|
||||
class String
|
||||
def read_ber syntax=nil
|
||||
StringIO.new(self).read_ber(syntax)
|
||||
end
|
||||
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