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.



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

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.



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

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.



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

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.



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

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.



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

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