Sha256: ebfcef218b624c7380668828bbf9ef27de7284472083232f07ce3edd993892fd

Contents?: true

Size: 1.91 KB

Versions: 39

Compression:

Stored size: 1.91 KB

Contents

# Copyright 2014 Google LLC
#
# 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
#
#     https://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 Trace
      ##
      # SpanKind represents values for the "kind" field of span.
      #
      class SpanKind
        @@mapping = {}

        ##
        # Create a new SpanKind.
        #
        # @private
        #
        def initialize name
          @name = name
          @@mapping[name] = self
        end

        ##
        # The `:SPAN_KIND_UNSPECIFIED` value
        #
        UNSPECIFIED = new :SPAN_KIND_UNSPECIFIED

        ##
        # The `:RPC_SERVER` value
        #
        RPC_SERVER = new :RPC_SERVER

        ##
        # The `:RPC_CLIENT` value
        #
        RPC_CLIENT = new :RPC_CLIENT

        ##
        # Returns the symbolic representation of this SpanKind
        #
        # @return [Symbol] Symbol representation.
        #
        def to_sym
          @name
        end

        ##
        # Returns the string representation of this SpanKind
        #
        # @return [String] String representation.
        #
        def to_s
          to_sym.to_s
        end

        ##
        # Returns the SpanKind given a symbol or string representation.
        #
        # @param [String, Symbol] name The name of the SpanKind.
        # @return [SpanKind] The SpanKind, or `nil` if not known.
        #
        def self.get name
          @@mapping[name.to_sym]
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/google-cloud-trace-0.42.2/lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.44.1 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.44.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.43.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.42.2 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.42.1 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.42.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.41.4 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.41.3 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.41.2 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.41.1 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.41.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.40.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.39.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.38.3 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.38.2 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.38.1 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.38.0 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.37.1 lib/google/cloud/trace/span_kind.rb
google-cloud-trace-0.37.0 lib/google/cloud/trace/span_kind.rb