Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/net/ber.rb

Instance Method Summary collapse

Instance Method Details

#to_berObject

to_ber



195
196
197
198
# File 'lib/net/ber.rb', line 195

def to_ber
  i = [self].pack('w')
  [2, i.length].pack("CC") + i
end

#to_ber_enumeratedObject

to_ber_enumerated



203
204
205
206
# File 'lib/net/ber.rb', line 203

def to_ber_enumerated
  i = [self].pack('w')
  [10, i.length].pack("CC") + i
end

#to_ber_length_encodingObject

to_ber_length_encoding



211
212
213
214
215
216
217
218
# File 'lib/net/ber.rb', line 211

def to_ber_length_encoding
  if self <= 127
    [self].pack('C')
  else
    i = [self].pack('N').sub(/^[\0]+/,"")
    [0x80 + i.length].pack('C') + i
  end
end