class Pry::Command::Cd - pry-0.10.1 Documentation

# class Pry::Command::Cd

### Public Instance Methods

process() click to toggle source

    # File lib/pry/commands/cd.rb, line 22
    def process
      state.old_stack ||= []

      if arg_string.strip == "-"
        unless state.old_stack.empty?
          _pry_.binding_stack, state.old_stack = state.old_stack, _pry_.binding_stack
        end
      else
        stack = ObjectPath.new(arg_string, _pry_.binding_stack).resolve

        if stack && stack != _pry_.binding_stack
          state.old_stack = _pry_.binding_stack
          _pry_.binding_stack = stack
        end
      end
    end