Sha256: 5e62df783639f24e0a96425c291331852bd4635a058f87bc0a3e8e39e259cbc1

Contents?: true

Size: 927 Bytes

Versions: 50

Compression:

Stored size: 927 Bytes

Contents

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

50 entries across 49 versions & 8 rubygems

Version Path
mfk_openapi_ruby_client-1.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.54.15 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.53.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.53.17 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.53.3 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.53.1 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.52.121 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.52.92 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.52.79 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.52.5 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.52.0 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.51.93 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.51.38 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.51.37 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.51.34 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.51.22 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
talon_one-2.0.0 vendor/bundle/ruby/2.7.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
talon_one-2.0.0 vendor/bundle/ruby/2.3.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.49.118 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb
cloudsmith-api-0.49.98 vendor/bundle/ruby/2.6.0/gems/ethon-0.12.0/lib/ethon/easy/debug_info.rb