module Garb

Attributes

ca_cert_file[W]
logger[RW]
open_timeout[W]
proxy_address[RW]
proxy_password[RW]
proxy_port[RW]
proxy_user[RW]
read_timeout[W]

Public Instance Methods

ca_cert_file() click to toggle source
# File lib/garb.rb, line 69
def ca_cert_file
  @ca_cert_file || raise(MissingCertFileError)
end
from_ga(thing)
from_google_analytics(thing) click to toggle source
# File lib/garb.rb, line 85
def from_google_analytics(thing)
  thing.to_s.gsub(/^ga\:/, '').underscore
end
Also aliased as: from_ga
log(str, level = :debug) click to toggle source
# File lib/garb.rb, line 73
def log(str, level = :debug)
  level, str = str, level if str.is_a? Symbol
  logger.send level, str unless logger.nil?
end
open_timeout() click to toggle source
# File lib/garb.rb, line 61
def open_timeout
  @open_timeout || 60
end
read_timeout() click to toggle source
# File lib/garb.rb, line 65
def read_timeout
  @read_timeout || 60
end
to_ga(thing)
Alias for: to_google_analytics
to_google_analytics(thing) click to toggle source
# File lib/garb.rb, line 78
def to_google_analytics(thing)
  return thing.to_google_analytics if thing.respond_to? :to_google_analytics

  "#{$1}ga:#{$2}" if "#{thing.to_s.camelize(:lower)}" =~ /^(-)?(.*)$/
end
Also aliased as: to_ga
use_fibers() click to toggle source
# File lib/garb.rb, line 57
def use_fibers
  @use_fibers || false
end
use_fibers=(val) click to toggle source
# File lib/garb.rb, line 49
def use_fibers=(val)
  if val and (!defined?(EM) || !defined?(Fiber))
    raise ArgumentError, 'Eventmachine and Fibers required (Ruby 1.9+ only)'
  end
  require 'em-net-http' if val
  @use_fibers = val
end