Class: UIntBase128

Inherits:
BinData::BasePrimitive
  • Object
show all
Defined in:
lib/woff/file.rb

Instance Method Summary collapse

Instance Method Details

#read_and_return_value(io) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/woff/file.rb', line 8

def read_and_return_value(io)
  value = 0
  offset = 0

  loop do
    byte = io.readbytes(1).unpack('C')[0]
    value |= (byte & 0x7F) << offset
    offset += 7
    if byte & 0x80 == 0
      break
    end
  end

  value
end

#sensible_defaultObject



24
25
26
# File 'lib/woff/file.rb', line 24

def sensible_default
  0
end

#value_to_binary_string(value) ⇒ Object

TODO: This should, like actually encode the value. This file might help: github.com/khaledhosny/woff2/blob/f43ad222715f58ea62a004b54e4b6a31e589e762/src/variable_length.cc



4
5
6
# File 'lib/woff/file.rb', line 4

def value_to_binary_string(value)
  "0"
end