Sha256: 25007992cfe79361af73952602ed9d8beff4ed76849d84fb2e16f9b1ee5dcc1a
Contents?: true
Size: 918 Bytes
Versions: 5
Compression:
Stored size: 918 Bytes
Contents
module Ethon class Easy class Mirror attr_reader :options alias_method :to_hash, :options def self.informations_to_mirror Informations::AVAILABLE_INFORMATIONS.keys + [:return_code, :response_headers, :response_body, :debug_info] end def self.informations_to_log [:url, :response_code, :return_code, :total_time] end def self.from_easy(easy) options = {} informations_to_mirror.each do |info| options[info] = easy.send(info) end new(options) end def initialize(options = {}) @options = options end def log_informations Hash[*self.class.informations_to_log.map do |info| [info, options[info]] end.flatten] end informations_to_mirror.each do |info| eval %Q|def #{info}; options[#{info}]; end| end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ethon-0.7.0 | lib/ethon/easy/mirror.rb |
ethon-0.6.3 | lib/ethon/easy/mirror.rb |
ethon-0.6.2 | lib/ethon/easy/mirror.rb |
ethon-0.6.1 | lib/ethon/easy/mirror.rb |
ethon-0.6.0 | lib/ethon/easy/mirror.rb |