fixes based on comments for pull request

This commit is contained in:
Chris Dwan 2011-11-17 14:23:41 -08:00
parent 463ac436a8
commit b6b7985d6e
4 changed files with 30 additions and 13 deletions

View file

@ -86,9 +86,11 @@ module Net::BER::Extensions::Array
# [['1.2.840.113556.1.4.805',true]]
#
def to_ber_control
ary = self.collect do |control_sequence|
control_sequence.collect{|element| element.to_ber}.to_ber_sequence
#if our array does not contain at least one array then wrap it in an array before going forward
ary = self[0].kind_of?(Array) ? self : [self]
ary = ary.collect do |control_sequence|
control_sequence.collect{|element| element.to_ber}.to_ber_sequence.reject_empty_ber_arrays
end
ary.to_ber_sequence #putting this on a new line to make it more readable.
ary.to_ber_sequence.reject_empty_ber_arrays
end
end