module Ethon::Multi::Options

This module contains the logic and knowledge about the available options on multi.

Public Instance Methods

max_total_connections=(value) click to toggle source

Sets max_total_connections option.

@example Set max_total_connections option.

easy.max_total_conections = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 16
def max_total_connections=(value)
  Curl.set_option(:max_total_connections, value_for(value, :int), handle, :multi)
end
maxconnects=(value) click to toggle source

Sets maxconnects option.

@example Set maxconnects option.

easy.maxconnects = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 28
def maxconnects=(value)
  Curl.set_option(:maxconnects, value_for(value, :int), handle, :multi)
end
pipelining=(value) click to toggle source

Sets pipelining option.

@example Set pipelining option.

easy.pipelining = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 40
def pipelining=(value)
  Curl.set_option(:pipelining, value_for(value, :bool), handle, :multi)
end
socketdata=(value) click to toggle source

Sets socketdata option.

@example Set socketdata option.

easy.socketdata = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 52
def socketdata=(value)
  Curl.set_option(:socketdata, value_for(value, :string), handle, :multi)
end
socketfunction=(value) click to toggle source

Sets socketfunction option.

@example Set socketfunction option.

easy.socketfunction = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 64
def socketfunction=(value)
  Curl.set_option(:socketfunction, value_for(value, :string), handle, :multi)
end
timerdata=(value) click to toggle source

Sets timerdata option.

@example Set timerdata option.

easy.timerdata = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 76
def timerdata=(value)
  Curl.set_option(:timerdata, value_for(value, :string), handle, :multi)
end
timerfunction=(value) click to toggle source

Sets timerfunction option.

@example Set timerfunction option.

easy.timerfunction = $value

@param [ String ] value The value to set.

@return [ void ]

# File lib/ethon/multi/options.rb, line 88
def timerfunction=(value)
  Curl.set_option(:timerfunction, value_for(value, :string), handle, :multi)
end

Private Instance Methods

value_for(value, type, option = nil) click to toggle source

Return the value to set to multi handle. It is converted with the help of bool_options, enum_options and int_options.

@example Return casted the value.

multi.value_for(:verbose)

@return [ Object ] The casted value.

# File lib/ethon/multi/options.rb, line 101
def value_for(value, type, option = nil)
  return nil if value.nil?

  if type == :bool
    value ? 1 : 0
  elsif type == :int
    value.to_i
  elsif value.is_a?(String)
    Ethon::Easy::Util.escape_zero_byte(value)
  else
    value
  end
end