Module: Cd::Proxy
- Defined in:
- lib/cd.rb
Class Method Summary collapse
- .-@ ⇒ Object
- .[](path) ⇒ Object
- .inspect ⇒ Object
- .ls(path = '.') ⇒ Object
- .pwd ⇒ Object
- .~ ⇒ Object
Class Method Details
.-@ ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/cd.rb', line 21 def self.-@ if @last_path cd @last_path else warn "Sorry, there is no previous directory." end end |
.[](path) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/cd.rb', line 29 def self.[](path) next_last_path = pwd FileUtils::Verbose.cd File.(path) @last_path = next_last_path Cd::Proxy.ls end |
.inspect ⇒ Object
44 45 46 |
# File 'lib/cd.rb', line 44 def self.inspect "#{to_s}[#{pwd.inspect}]" end |
.ls(path = '.') ⇒ Object
36 37 38 |
# File 'lib/cd.rb', line 36 def self.ls(path = '.') Dir["#{path}/*"].map{ |filename| File.basename filename } end |
.pwd ⇒ Object
40 41 42 |
# File 'lib/cd.rb', line 40 def self.pwd FileUtils.pwd end |
.~ ⇒ Object
17 18 19 |
# File 'lib/cd.rb', line 17 def self.~ cd '~' end |