module Cborb::Decoding::Types::IntegerDecodable
In CBOR, The process that decode some bytes as integer is popular. Thus, we modularize that.
Constants
- UNPACK_TEMPLATES
Public Instance Methods
consume_as_integer(state, additional_info)
click to toggle source
@param [Cborb::Decoding::State] state @param [Integer] additional_info @return [Integer]
# File lib/cborb/decoding/types/integer_decodable.rb, line 15 def consume_as_integer(state, additional_info) return additional_info if additional_info < 24 index = additional_info - 24 bytesize = 2**index state.consume(bytesize).unpack(UNPACK_TEMPLATES[index]).first end