Skip to content

Commit 158e5b2

Browse files
committed
Keep backward compatibility
Generated files with 0.0.3 can be used with 0.0.4.
1 parent 95ed69b commit 158e5b2

File tree

11 files changed

+21
-11
lines changed

11 files changed

+21
-11
lines changed

lib/flatbuffers.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/data_definable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/field.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/reflection/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
module FlatBuffers
1515
module Reflection
16-
class Schema < ::FlatBuffers::RootTable
16+
class Schema < ::FlatBuffers::Table
1717
def advanced_features
1818
field_offset = @view.unpack_virtual_offset(16)
1919
if field_offset.zero?

lib/flatbuffers/root_table.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

lib/flatbuffers/table.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -33,6 +33,16 @@ def serialize(data, table_serializer)
3333
end
3434

3535
def initialize(view)
36+
unless view.is_a?(View)
37+
# For backward compatibility
38+
if view.is_a?(IO::Buffer)
39+
buffer = view
40+
else
41+
buffer = IO::Buffer.for(view)
42+
end
43+
offset = buffer.get_value(:u32, 0)
44+
view = View.new(buffer, offset, have_vtable: true)
45+
end
3646
@view = view
3747
end
3848

lib/flatbuffers/view.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

test/test_reflection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Sutou Kouhei <[email protected]>
1+
# Copyright 2025-2026 Sutou Kouhei <[email protected]>
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)