Sha256: 6cfdf20d1b1ab1128c0bda9ec4bc5412e0a304eeb083f7991fe921fa77e350e5
Contents?: true
Size: 1.17 KB
Versions: 11
Compression:
Stored size: 1.17 KB
Contents
module GroupDocs module Api module Helpers module ByteFlag # # Converts array of values to byte flag using hash of value => byte. # # @param [Array<String, Symbol>] values # @param [Hash] value_byte_hash # @return [Integer] # @raise [ArgumentError] if values is not an array # @api private # def byte_from_array(values, value_byte_hash) flag = 0 values.each do |value| flag += value_byte_hash[value] end flag end # # Converts byte flag to array of values using hash of value => byte. # # @param [Integer] byte # @param [Hash] value_byte_hash # @return [Integer] # @api private # def array_from_byte(byte, value_byte_hash) values = [] value_byte_hash.reverse_each do |value, flag| decreased_byte = byte - flag if decreased_byte >= 0 values << value byte = decreased_byte end end values end end # ByteFlag end # Helpers end # Api end # GroupDocs
Version data entries
11 entries across 11 versions & 1 rubygems