Sha256: 69ed2347f2a9609ae5405a6d81cf525f736e06af8492dd98f2484a52ce936012

Contents?: true

Size: 774 Bytes

Versions: 391

Compression:

Stored size: 774 Bytes

Contents

# Protocol Buffers - Google's data interchange format
# Copyright 2022 Google Inc.  All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd

# A to_native DataConverter method that raises an error if the value is not of the same type.
# Adapted from to https://www.varvet.com/blog/advanced-topics-in-ruby-ffi/
module Google
  module Protobuf
    module Internal
      module TypeSafety
        def to_native(value, ctx = nil)
          if value.kind_of?(self) or value.nil?
            super
          else
            raise TypeError.new "Expected a kind of #{name}, was #{value.class}"
          end
        end
      end
    end
  end
end

Version data entries

391 entries across 391 versions & 2 rubygems

Version Path
google-protobuf-4.29.4-java lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x86_64-linux lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x86_64-darwin lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x86-mingw32 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x86-linux lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x64-mingw32 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-x64-mingw-ucrt lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-arm64-darwin lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.29.4-aarch64-linux lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-java lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x86_64-linux lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x86_64-darwin lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x86-mingw32 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x86-linux lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x64-mingw32 lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-x64-mingw-ucrt lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-arm64-darwin lib/google/protobuf/ffi/internal/type_safety.rb
google-protobuf-4.30.1-aarch64-linux lib/google/protobuf/ffi/internal/type_safety.rb