Class: Ethon::Easy::Mirror

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

Constant Summary collapse

INFORMATIONS_TO_MIRROR =
Informations::AVAILABLE_INFORMATIONS.keys +
[:return_code, :response_headers, :response_body, :debug_info]
INFORMATIONS_TO_LOG =
[:effective_url, :response_code, :return_code, :total_time]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mirror


20
21
22
# File 'lib/ethon/easy/mirror.rb', line 20

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly) Also known as: to_hash

Returns the value of attribute options


4
5
6
# File 'lib/ethon/easy/mirror.rb', line 4

def options
  @options
end

Class Method Details

.from_easy(easy) ⇒ Object


12
13
14
15
16
17
18
# File 'lib/ethon/easy/mirror.rb', line 12

def self.from_easy(easy)
  options = {}
  INFORMATIONS_TO_MIRROR.each do |info|
    options[info] = easy.send(info)
  end
  new(options)
end

Instance Method Details

#log_informationsObject


24
25
26
27
28
# File 'lib/ethon/easy/mirror.rb', line 24

def log_informations
  Hash[*INFORMATIONS_TO_LOG.map do |info|
    [info, options[info]]
  end.flatten]
end