Class: TreeRepl::Cd

Inherits:
Cmd
  • Object
show all
Defined in:
lib/treerepl/cmds.rb

Instance Attribute Summary

Attributes inherited from Cmd

#name, #repl

Instance Method Summary collapse

Constructor Details

#initialize(repl) ⇒ Cd

Returns a new instance of Cd.



54
55
56
# File 'lib/treerepl/cmds.rb', line 54

def initialize(repl)
  super(repl,'cd')
end

Instance Method Details

#exec(args) ⇒ Object



57
58
59
60
61
62
# File 'lib/treerepl/cmds.rb', line 57

def exec(args)
  args = ['/'] if args.empty?
  path = args.join ' '
  n = repl.eval_path repl.cur,path
  repl.cur = n if n
end

#helpObject



63
64
65
# File 'lib/treerepl/cmds.rb', line 63

def help
  'Change directory'
end