class RJack::AsyncHTTPClient::AsyncHttpClientConfig

Extensions to com.ning.http.client.AsyncHttpClientConfig supporting inspection as a options hash.

Constants

GET_TO_SETTERS

Public Instance Methods

to_hash() click to toggle source

Return a Hash represention of self, suitable for use a template to RJack::AsyncHTTPClient#build_client

# File lib/rjack-async-httpclient.rb, line 47
def to_hash
  props = self.methods.
    map { |m| m =~ /^(is|get)_([a-z0-9_]+)$/ && $2 }.
    compact

  props -= %w[ valid class closed ]      #bogus
  props += %w[ executor_service ]        #without get_

  props.map! { |p| p.to_sym }
  props.inject( {} ) do |h,p|
    h[ GET_TO_SETTERS[ p ] || p ] = send( p )
    h
  end
end
to_s() click to toggle source

Return sorted, multi-line print of #to_hash

# File lib/rjack-async-httpclient.rb, line 63
def to_s
  out = "{ "
  kv = to_hash.sort { |p,n| p[0].to_s <=> n[0].to_s }
  kv.each do |k,v|
    out << ",\n  " if out.length > 2
    out << ":#{ k } => #{ v_inspect( v ) }"
  end
  out << " }"
  out
end