class Bundler::Thor::NestedContext - bundler: Ruby Standard Library Documentation

# class Bundler::Thor::NestedContext

### Public Class Methods

new() click to toggle source

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

### Public Instance Methods

enter() { || ... } click to toggle source

    # File bundler/vendor/thor/lib/thor/nested_context.rb, line 7
    def enter
      push

      yield
    ensure
      pop
    end

entered?() click to toggle source

    # File bundler/vendor/thor/lib/thor/nested_context.rb, line 15
    def entered?
      @depth.positive?
    end

### Private Instance Methods

pop() click to toggle source

    # File bundler/vendor/thor/lib/thor/nested_context.rb, line 25
    def pop
      @depth -= 1
    end

push() click to toggle source

    # File bundler/vendor/thor/lib/thor/nested_context.rb, line 21
    def push
      @depth += 1
    end