Sha256: e6ece042c8c26da83bf1e37d8948b261e7f42805db099be74fdb408608545170
Contents?: true
Size: 740 Bytes
Versions: 1
Compression:
Stored size: 740 Bytes
Contents
require 'fileutils' module Cd VERSION = '1.0.0' extend self def cd(path = nil) if !path Cd::Proxy else Cd::Proxy[path] end end module Proxy def self.~ cd '~' end def self.-@ if @last_path cd @last_path else warn "Sorry, there is no previous directory." end end def self.[](path) next_last_path = pwd FileUtils::Verbose.cd File.expand_path(path) @last_path = next_last_path Cd::Proxy.ls end def self.ls(path = '.') Dir["#{path}/*"].map{ |filename| File.basename filename } end def self.pwd FileUtils.pwd end def self.inspect "#{to_s}[#{pwd.inspect}]" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cd-1.0.0 | lib/cd.rb |