Class: Ethon::Easy::DebugInfo Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ethon/easy/debug_info.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is used to store and retreive debug information, which is only saved when verbose is set to true.

Defined Under Namespace

Classes: Message

Constant Summary collapse

MESSAGE_TYPES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Ethon::Curl::DebugInfoType.to_h.keys

Instance Method Summary collapse

Constructor Details

#initializeDebugInfo

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of DebugInfo.


21
22
23
# File 'lib/ethon/easy/debug_info.rb', line 21

def initialize
  @messages = []
end

Instance Method Details

#add(type, message) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


25
26
27
# File 'lib/ethon/easy/debug_info.rb', line 25

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

#messages_for(type) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


29
30
31
# File 'lib/ethon/easy/debug_info.rb', line 29

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

#to_aObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


37
38
39
# File 'lib/ethon/easy/debug_info.rb', line 37

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

#to_hObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


41
42
43
# File 'lib/ethon/easy/debug_info.rb', line 41

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