Class: Protobuf::Varint
- Inherits:
-
Object
- Object
- Protobuf::Varint
- Extended by:
- VarintPure, ProtobufJavaHelpers::EncodeDecode, Varint
- Defined in:
- lib/protobuf/varint.rb
Constant Summary
Constants included from VarintPure
Protobuf::VarintPure::CACHE_LIMIT
Class Method Summary collapse
Methods included from VarintPure
Class Method Details
.encode(value) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/protobuf/varint.rb', line 6 def self.encode(value) bytes = [] until value < 128 bytes << (0x80 | (value & 0x7f)) value >>= 7 end (bytes << value).pack('C*') end |