Class: Bundler::Thor::NestedContext

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/vendor/thor/lib/thor/nested_context.rb

Instance Method Summary collapse

Constructor Details

#initializeNestedContext

Returns a new instance of NestedContext.



3
4
5
# File 'lib/bundler/vendor/thor/lib/thor/nested_context.rb', line 3

def initialize
  @depth = 0
end

Instance Method Details

#enterObject



7
8
9
10
11
12
13
# File 'lib/bundler/vendor/thor/lib/thor/nested_context.rb', line 7

def enter
  push

  yield
ensure
  pop
end

#entered?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bundler/vendor/thor/lib/thor/nested_context.rb', line 15

def entered?
  @depth > 0
end