module Typhoeus
def before(&block)
-
(Array
- All before blocks.)
Other tags:
- Yield: -
Parameters:
-
block
(Block
) -- The callback.
Other tags:
- Example: Add before callback. -
def before(&block) @before ||= [] @before << block if block_given? @before end
def configure
- See: Typhoeus::Config -
Returns:
-
(Typhoeus::Config)
- The configuration.
Other tags:
- Yield: -
Other tags:
- Example: -
def configure yield Config end
def stub(url, options = {})
- See: Typhoeus::Expectation -
Returns:
-
(Typhoeus::Expectation)
- The expecatation.
Parameters:
-
options
(Hash
) -- The options to stub out. -
url
(String
) -- The url to stub out.
Other tags:
- Example: -
def stub(url, options = {}) expectation = Expectation.all.find{ |e| e.url == url && e.options == options } return expectation if expectation Expectation.new(url, options).tap do |new_expectation| Expectation.all << new_expectation end end
def with_connection
- See: Typhoeus::Config#block_connection -
Returns:
-
(Object)
- Returns the return value of block.
Parameters:
-
block
(Block
) -- The block to execute.
Other tags:
- Example: Make a real request, no matter if its blocked. -
def with_connection old = Config.block_connection Config.block_connection = false result = yield if block_given? Config.block_connection = old result end