Sha256: d591b69b5b9e4834d78f7f8ed469e2e1308e3ce06e7ddc3c893a11a858934058
Contents?: true
Size: 1.05 KB
Versions: 11
Compression:
Stored size: 1.05 KB
Contents
module GitObjectBrowser module Models class Bindata def initialize(input) @in = input end def switch_source(input) tmp = @in @in = input yield ensure @in = tmp end def raw(bytes) @in.read(bytes) end def bytes(bytes) @in.read(bytes).unpack('C*') end def byte bytes(1).first end def int @in.read(4).unpack('N').first.to_i end def hex(bytes) @in.read(bytes).unpack('H*').first end def binstr(bytes) @in.read(bytes).unpack('B*').first end def find_char(char) buf = '' loop do c = @in.read(1) return buf if c.nil? || c == char buf += c end end def skip(bytes) @in.seek(bytes, IO::SEEK_CUR) end def seek(bytes) @in.seek(bytes) end def peek(bytes) result = raw(bytes) @in.seek(bytes * -1, IO::SEEK_CUR) result end end end end
Version data entries
11 entries across 11 versions & 1 rubygems