Sha256: b86f6c3b62f6db03dc4b34bb2a47a412fb4550bca019ad304e9c32eb82e7b291

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

# Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


module Google
  module Cloud
    module Language
      ##
      # @private Conversion to/from Language GRPC objects.
      module Convert
        ##
        # @private Convert a Google::Protobuf::Map to a Hash
        def self.map_to_hash map
          if map.respond_to? :to_h
            map.to_h
          else
            # Enumerable doesn't have to_h on ruby 2.0...
            Hash[map.to_a]
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
google-cloud-language-0.27.1 lib/google/cloud/language/convert.rb
google-cloud-language-0.27.0 lib/google/cloud/language/convert.rb
google-cloud-language-0.26.2 lib/google/cloud/language/convert.rb
google-cloud-language-0.26.1 lib/google/cloud/language/convert.rb
google-cloud-language-0.26.0 lib/google/cloud/language/convert.rb
google-cloud-language-0.25.0 lib/google/cloud/language/convert.rb
google-cloud-language-0.24.0 lib/google/cloud/language/convert.rb