Sha256: 77207f4e44758a3dc3dbc0d4db0e0b1094de8b139d0b1ab60578a4b5dd94b10d

Contents?: true

Size: 957 Bytes

Versions: 6803

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true
module Ethon
  class Easy

    # This class is used to store and retreive debug information,
    # which is only saved when verbose is set to true.
    #
    # @api private
    class DebugInfo

      MESSAGE_TYPES = Ethon::Curl::DebugInfoType.to_h.keys

      class Message
        attr_reader :type, :message

        def initialize(type, message)
          @type = type
          @message = message
        end
      end

      def initialize
        @messages = []
      end

      def add(type, message)
        @messages << Message.new(type, message)
      end

      def messages_for(type)
        @messages.select {|m| m.type == type }.map(&:message)
      end

      MESSAGE_TYPES.each do |type|
        eval %Q|def #{type}; messages_for(:#{type}); end|
      end

      def to_a
        @messages.map(&:message)
      end

      def to_h
        Hash[MESSAGE_TYPES.map {|k| [k, send(k)] }]
      end
    end
  end
end

Version data entries

6,803 entries across 6,801 versions & 24 rubygems

Version Path
ory-kratos-client-0.9.0.alpha2 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha144 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha143 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha142 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha141 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha140 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha139 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha138 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha134 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha133 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha132 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha131 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-1.42.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha130 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/2.6.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.1.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
devcycle-ruby-server-sdk-1.1.0 examples/sinatra/vendor/bundle/ruby/3.0.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha129 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha128 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb
ory-client-0.0.1.alpha127 vendor/bundle/ruby/2.5.0/gems/ethon-0.15.0/lib/ethon/easy/debug_info.rb