lib/hexapdf/utils/bit_stream.rb in hexapdf-0.6.0 vs lib/hexapdf/utils/bit_stream.rb in hexapdf-0.7.0
- old
+ new
@@ -1,12 +1,12 @@
-# -*- encoding: utf-8 -*-
+# -*- encoding: utf-8; frozen_string_literal: true -*-
#
#--
# This file is part of HexaPDF.
#
# HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby
-# Copyright (C) 2014-2017 Thomas Leitner
+# Copyright (C) 2014-2018 Thomas Leitner
#
# HexaPDF is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3 as
# published by the Free Software Foundation with the addition of the
# following permission added to Section 15 as permitted in Section 7(a):
@@ -42,11 +42,11 @@
# method. The data from where these bits are read, can be set on intialization and additional
# data can later be appended.
class BitStreamReader
# Creates a new object, optionally providing the string from where the bits should be read.
- def initialize(data = '')
+ def initialize(data = +'')
@data = data.force_encoding(Encoding::BINARY)
@pos = 0
@bit_cache = 0
@available_bits = 0
end
@@ -56,10 +56,10 @@
@data.slice!(0, @pos)
@data << str
@pos = 0
self
end
- alias :<< :append_data
+ alias << append_data
# Returns the number of remaining bits that can be read.
def remaining_bits
(@data.length - @pos) * 8 + @available_bits
end