Module: GH

Extended by:
SingleForwardable
Defined in:
lib/gh.rb,
lib/gh/case.rb,
lib/gh/cache.rb,
lib/gh/error.rb,
lib/gh/stack.rb,
lib/gh/remote.rb,
lib/gh/version.rb,
lib/gh/wrapper.rb,
lib/gh/parallel.rb,
lib/gh/response.rb,
lib/gh/normalizer.rb,
lib/gh/pagination.rb,
lib/gh/lazy_loader.rb,
lib/gh/merge_commit.rb,
lib/gh/link_follower.rb,
lib/gh/faraday_adapter.rb,
lib/gh/instrumentation.rb,
lib/gh/nested_resources.rb,
lib/gh/response_wrapper.rb

Defined Under Namespace

Modules: Case Classes: Cache, Error, FaradayAdapter, Instrumentation, LazyLoader, LinkFollower, MergeCommit, NestedResources, Normalizer, Pagination, Parallel, Remote, Response, ResponseWrapper, Stack, Wrapper

Constant Summary collapse

DefaultStack =
Stack.new do
  use Instrumentation
  use Parallel
  use Pagination
  use LinkFollower
  use MergeCommit
  use LazyLoader
  use Normalizer
  use Remote
end
VERSION =

Public: Library version.

"0.7.3"

Class Method Summary collapse

Class Method Details

.currentObject



41
42
43
# File 'lib/gh.rb', line 41

def self.current
  Thread.current[:GH] ||= DefaultStack.new
end

.current=(backend) ⇒ Object



45
46
47
# File 'lib/gh.rb', line 45

def self.current=(backend)
  Thread.current[:GH] = backend
end

.with(backend) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gh.rb', line 23

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