Sha256: 1e5442716965c05918cb4635bb39a5cd172e80a659573883b5318f4c17c715e2

Contents?: true

Size: 770 Bytes

Versions: 7

Compression:

Stored size: 770 Bytes

Contents

module MessagePack
  class Packer
    # see ext for other methods

    # The semantic of duping a packer is just too weird.
    undef_method :dup
    undef_method :clone

    def registered_types
      list = []

      registered_types_internal.each_pair do |klass, ary|
        list << {type: ary[0], class: klass, packer: ary[2]}
      end

      list.sort{|a, b| a[:type] <=> b[:type] }
    end

    def type_registered?(klass_or_type)
      case klass_or_type
      when Class
        klass = klass_or_type
        registered_types.any?{|entry| klass <= entry[:class] }
      when Integer
        type = klass_or_type
        registered_types.any?{|entry| type == entry[:type] }
      else
        raise ArgumentError, "class or type id"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
msgpack-1.7.1-java lib/msgpack/packer.rb
msgpack-1.7.1 lib/msgpack/packer.rb
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/msgpack-1.7.0/lib/msgpack/packer.rb
msgpack-1.7.0-java lib/msgpack/packer.rb
msgpack-1.7.0 lib/msgpack/packer.rb
msgpack-1.6.1-java lib/msgpack/packer.rb
msgpack-1.6.1 lib/msgpack/packer.rb