| 1 | # frozen_string_literal: true |
| 2 | |
| 3 | # Polyfill for String#append_as_bytes, which didn't exist until Ruby 3.4. |
| 4 | if !("".respond_to?(:append_as_bytes)) |
| 5 | String.include( |
| 6 | Module.new { |
| 7 | def append_as_bytes(*args) |
| 8 | args.each do |arg| |
| 9 | arg = Integer === arg ? [arg].pack("C") : arg.b |
| 10 | self.<<(arg) # steep:ignore |
| 11 | end |
| 12 | end |
| 13 | } |
| 14 | ) |
| 15 | end |