Skip to content

Commit

Permalink
Fixed functionality of #from_file within non-main Ractors, wvanbergen…
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHashTableSlasher committed Dec 22, 2022
1 parent 7a1faf6 commit 50507ca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The file documents the changes to this library over the different versions.

=== Unreleased changes

- Fixed functionality of #from_file within non-main Ractors.

=== 1.4.0 - 2020-12-28

- Add compatibility for Ruby 3.0.
Expand Down
2 changes: 1 addition & 1 deletion lib/chunky_png.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class UnitsUnknown < ChunkyPNG::Exception
# Null-byte, with the encoding set correctly to ASCII-8BIT (binary) in Ruby 1.9.
# @return [String] A binary string, consisting of one NULL-byte.
# @private
EXTRA_BYTE = "\0".b
EXTRA_BYTE = "\0".b.freeze
end

require "chunky_png/version"
Expand Down
2 changes: 1 addition & 1 deletion lib/chunky_png/chunk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,6 @@ def content
"zTXt" => CompressedText,
"iTXt" => InternationalText,
"pHYs" => Physical,
}
}.freeze
end
end
2 changes: 1 addition & 1 deletion lib/chunky_png/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def euclidean_distance_rgba(pixel_after, pixel_before)
whitesmoke: 0xf5f5f500,
yellow: 0xffff0000,
yellowgreen: 0x9acd3200,
}
}.freeze

# Gets a color value based on a HTML color name.
#
Expand Down
5 changes: 5 additions & 0 deletions spec/chunky_png/canvas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,9 @@
expect(subject.inspect).to eql "<ChunkyPNG::Canvas 1x1 [\n\t[#ffffffff]\n]>"
end
end

it "should behave properly with the new Ruby 3.0 Ractors" do
img = Ractor.new { ChunkyPNG::Canvas.from_file(resource_file("operations.png")) }.take
expect(img).to eql ChunkyPNG::Canvas.from_file(resource_file("operations.png"))
end
end

0 comments on commit 50507ca

Please sign in to comment.