impress/vendor/gems/RocketAMF-1.0.0/lib/rocketamf/extensions.rb
Emi Matchu b1f06029f8 Moderize RocketAMF C types to fix build error
I'm not sure if this is a Mac-only problem or what, but we were getting incompatible-function-pointer errors when trying to build the RocketAMF C extensions. This fixes that! (Maybe it's like, Mac-only but as of Ruby 3.4 in specific? We're running RocketAMF in production on Ruby 3.4 right now without this. Shrug.)
2025-10-30 02:45:56 +00:00

22 lines
No EOL
591 B
Ruby

# Joc's monkeypatch for string bytesize (only available in 1.8.7+)
if !"amf".respond_to? :bytesize
class String #:nodoc:
def bytesize
self.size
end
end
end
# Add <tt>ArrayCollection</tt> override to arrays
class Array
# Override <tt>RocketAMF::ClassMapper.use_array_collection</tt> setting for
# this array. Adds <tt>is_array_collection?</tt> method, which is used by the
# serializer over the global config if defined.
def is_array_collection= a
@is_array_collection = a
def self.is_array_collection? #:nodoc:
@is_array_collection
end
end
end