Module | Ethon::Curls::Options |
In: |
lib/ethon/curls/options.rb
|
This module contains logic for setting options on easy or multi interface.
OPTION_STRINGS | = | { :easy => 'easy_options', :multi => 'multi_options' }.freeze |
FOPTION_STRINGS | = | { :easy => 'EASY_OPTIONS', :multi => 'MULTI_OPTIONS' }.freeze |
FTYPES | = | [:long, :string, :ffipointer, :callback, :debug_callback, :progress_callback, :off_t] |
FUNCS | = | Hash[*[:easy, :multi].zip([:easy, :multi].map { |t| Hash[*FTYPES.zip(FTYPES.map { |ft| "#{t}_setopt_#{ft}" }).flatten] }).flatten] |
OPTION_TYPE_BASE | = | { :long => 0, :objectpoint => 10000, :functionpoint => 20000, :off_t => 30000 |
OPTION_TYPE_MAP | = | { :none => :long, :int => :long, :bool => :long, :time => :long, :enum => :long, # Two ways to specify values (as opts parameter): # * Array of symbols, these will number sequentially # starting at 0. Skip elements with nil. (see :netrc) # * Hash of :symbol => enum_value (See :proxytype) :bitmask => :long, # Three ways to specify values (as opts parameter): # * Hash of :symbol => bitmask_value or Array. # An Array can be an array of already defined # Symbols, which represents a bitwise or of those # symbols. (See :httpauth) # * Array of symbols, these will number the bits # sequentially (i.e. 0, 1, 2, 4, etc.). Skip # elements with nil. The last element can be a # Hash, which will be interpreted as above. # (See :protocols) # :all defaults to all bits set :string => :objectpoint, :string_escape_null => :objectpoint, :string_as_pointer => :objectpoint, :ffipointer => :objectpoint, # FFI::Pointer :curl_slist => :objectpoint, :buffer => :objectpoint, # A memory buffer of size defined in the options :dontuse_object => :objectpoint, # An object we don't support (e.g. FILE*) :cbdata => :objectpoint, :callback => :functionpoint, :debug_callback => :functionpoint, :progress_callback => :functionpoint, :off_t => :off_t, } |
Sets appropriate option for easy, depending on value type.