module Typhoeus

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/typhoeus.rbs

module Typhoeus
  def self.before: () -> Array[]
end

def self.before(&block)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.before: () ->

This signature was generated using 39 samples from 3 applications.

Returns:
  • (Array) - All before blocks.

Other tags:
    Yield: -

Parameters:
  • block (Block) -- The callback.

Other tags:
    Example: Add before callback. -
def self.before(&block)
  @before ||= []
  @before << block if block_given?
  @before
end

def self.configure

Other tags:
    See: Typhoeus::Config -

Returns:
  • (Typhoeus::Config) - The configuration.

Other tags:
    Yield: -

Other tags:
    Example: -
def self.configure
  yield Config
end

def self.stub(base_url, options = {}, &block)

Other tags:
    See: Typhoeus::Expectation -

Returns:
  • (Typhoeus::Expectation) - The expecatation.

Parameters:
  • options (Hash) -- The options to stub out.
  • base_url (String) -- The url to stub out.

Other tags:
    Example: -
def self.stub(base_url, options = {}, &block)
  expectation = Expectation.all.find{ |e| e.base_url == base_url && e.options == options }
  if expectation.nil?
    expectation = Expectation.new(base_url, options)
    Expectation.all << expectation
  end
  expectation.and_return(&block) unless block.nil?
  expectation
end

def self.with_connection

Other tags:
    See: Typhoeus::Config.block_connection -

Returns:
  • (Object) - Returns the return value of the block.

Other tags:
    Yield: - Yields control to the block after disabling block_connection.

Other tags:
    Example: Make a real request, no matter if it's blocked. -
def self.with_connection
  old = Config.block_connection
  Config.block_connection = false
  result = yield if block_given?
  Config.block_connection = old
  result
end