module GH

Constants

DefaultStack
ResponseWrapper
VERSION

Public: Library version.

Public Class Methods

Error(conditions) click to toggle source
# File lib/gh/error.rb, line 56
def self.Error(conditions)
  Module.new do
    define_singleton_method(:===) do |exception|
      return false unless Error === exception and not exception.info.nil?
      conditions.all? { |k,v| v === exception.info[k]}
    end
  end
end
current() click to toggle source
# File lib/gh.rb, line 48
def self.current
  Thread.current[:GH] ||= DefaultStack.new
end
current=(backend) click to toggle source
# File lib/gh.rb, line 52
def self.current=(backend)
  Thread.current[:GH] = backend
end
method_missing(*args, &block) click to toggle source
# File lib/gh.rb, line 59
def self.method_missing(*args, &block)
  current.public_send(*args, &block)
end
set(options) click to toggle source
# File lib/gh.rb, line 43
def self.set(options)
  Thread.current[:GH] = nil
  DefaultStack.options.merge! options
end
with(backend) { || ... } click to toggle source
# File lib/gh.rb, line 25
def self.with(backend)
  if Hash === backend
    @options ||= {}
    @options, options = @options.merge(backend), @options
    backend = DefaultStack.build(@options)
  end

  if block_given?
    was, self.current = current, backend
    yield
  else
    backend
  end
ensure
  @options = options if options
  self.current = was if was
end