class Bundler::Thor::NestedContext

Parent:
Object

Public Class Methods

new() Show source
# File lib/bundler/vendor/thor/lib/thor/nested_context.rb, line 3
def initialize
  @depth = 0
end

Public Instance Methods

enter() { || ... } Show source
# File lib/bundler/vendor/thor/lib/thor/nested_context.rb, line 7
def enter
  push

  yield
ensure
  pop
end
entered?() Show source
# File lib/bundler/vendor/thor/lib/thor/nested_context.rb, line 15
def entered?
  @depth > 0
end

Private Instance Methods

pop() Show source
# File lib/bundler/vendor/thor/lib/thor/nested_context.rb, line 25
def pop
  @depth -= 1
end
push() Show source
# File lib/bundler/vendor/thor/lib/thor/nested_context.rb, line 21
def push
  @depth += 1
end

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.