Sha256: d3f4c48e64b66c2ad0dca4ec369d473178b57cc7ecb44479cceb988c3e8a0b98
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
module Faraday # Loads each autoloaded constant. If thread safety is a concern, wrap # this in a Mutex. def self.load constants.each do |const| const_get(const) if autoload?(const) end end autoload :Connection, 'faraday/connection' autoload :Response, 'faraday/response' autoload :Error, 'faraday/error' module Adapter autoload :NetHttp, 'faraday/adapter/net_http' autoload :Typhoeus, 'faraday/adapter/typhoeus' autoload :MockRequest, 'faraday/adapter/mock_request' # Names of available adapters. Should not actually load them. def self.adapters constants end # Array of Adapters. These have been loaded and confirmed to work (right gems, etc). def self.loaded_adapters adapters.map { |c| const_get(c) }.select { |a| a.loaded? } end end end # not pulling in active-support JUST for this method. class Object # Yields <code>x</code> to the block, and then returns <code>x</code>. # The primary purpose of this method is to "tap into" a method chain, # in order to perform operations on intermediate results within the chain. # # (1..10).tap { |x| puts "original: #{x.inspect}" }.to_a. # tap { |x| puts "array: #{x.inspect}" }. # select { |x| x%2 == 0 }. # tap { |x| puts "evens: #{x.inspect}" }. # map { |x| x*x }. # tap { |x| puts "squares: #{x.inspect}" } def tap yield self self end unless Object.respond_to?(:tap) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faraday-0.0.1 | lib/faraday.rb |