Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/net/ber.rb
Instance Method Summary collapse
-
#to_ber ⇒ Object
to_ber.
-
#to_ber_enumerated ⇒ Object
to_ber_enumerated.
-
#to_ber_length_encoding ⇒ Object
to_ber_length_encoding.
Instance Method Details
#to_ber ⇒ Object
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_enumerated ⇒ Object
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_encoding ⇒ Object
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 |