lib/gh.rb in gh-0.8.0 vs lib/gh.rb in gh-0.9.0

- old
+ new

@@ -3,10 +3,11 @@ require 'forwardable' module GH autoload :Cache, 'gh/cache' autoload :Case, 'gh/case' + autoload :CustomLimit, 'gh/custom_limit' autoload :Error, 'gh/error' autoload :FaradayAdapter, 'gh/faraday_adapter' autoload :Instrumentation, 'gh/instrumentation' autoload :LazyLoader, 'gh/lazy_loader' autoload :LinkFollower, 'gh/link_follower' @@ -36,27 +37,33 @@ ensure @options = options if options self.current = was if was end + def self.set(options) + Thread.current[:GH] = nil + DefaultStack.options.merge! options + end + def self.current Thread.current[:GH] ||= DefaultStack.new end def self.current=(backend) Thread.current[:GH] = backend end extend SingleForwardable - def_delegators :current, :api_host, :[], :reset, :load, :post, :delete, :patch, :put, :in_parallel, :in_parallel?, :options + def_delegators :current, :api_host, :[], :reset, :load, :post, :delete, :patch, :put, :in_parallel, :in_parallel?, :options, :head DefaultStack = Stack.new do use Instrumentation use Parallel use Pagination use LinkFollower use MergeCommit use LazyLoader use Normalizer + use CustomLimit use Remote end end