lib/gh.rb in gh-0.5.1 vs lib/gh.rb in gh-0.6.0
- old
+ new
@@ -20,13 +20,14 @@
autoload :Stack, 'gh/stack'
autoload :Wrapper, 'gh/wrapper'
def self.with(backend)
backend = DefaultStack.build(backend) if Hash === backend
+ return backend unless block_given?
was, self.current = current, backend
yield
ensure
- self.current = was
+ self.current = was if was
end
def self.current
Thread.current[:GH] ||= DefaultStack.new
end