lib/avro/data_file.rb in avro-1.10.2 vs lib/avro/data_file.rb in avro-1.11.0
- old
+ new
@@ -1,15 +1,16 @@
+# frozen_string_literal: true
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# https://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -23,11 +24,11 @@
MAGIC.force_encoding('BINARY') if MAGIC.respond_to?(:force_encoding)
MAGIC_SIZE = MAGIC.respond_to?(:bytesize) ? MAGIC.bytesize : MAGIC.size
SYNC_SIZE = 16
SYNC_INTERVAL = 4000 * SYNC_SIZE
META_SCHEMA = Schema.parse('{"type": "map", "values": "bytes"}')
- VALID_ENCODINGS = ['binary'] # not used yet
+ VALID_ENCODINGS = ['binary'].freeze # not used yet
class DataFileError < AvroError; end
def self.open(file_path, mode='r', schema=nil, codec=nil)
schema = Avro::Schema.parse(schema) if schema
@@ -97,10 +98,10 @@
# If writers_schema is not present, presume we're appending
@writer = writer
@encoder = IO::BinaryEncoder.new(@writer)
@datum_writer = datum_writer
@meta = meta
- @buffer_writer = StringIO.new('', 'w')
+ @buffer_writer = StringIO.new(+'', 'w')
@buffer_writer.set_encoding('BINARY') if @buffer_writer.respond_to?(:set_encoding)
@buffer_encoder = IO::BinaryEncoder.new(@buffer_writer)
@block_count = 0
if writers_schema