module Monkey::Ext::Pathname
Public Instance Methods
cased_path()
click to toggle source
@return [Pathname, NilClass] Path with correct casing.
# File lib/monkey/ext/pathname.rb, line 8 def cased_path return unless exist? return Dir.chdir(self) { Pathname(Dir.pwd) } if ::File.directory? path files = Dir.chdir(dirname) { Dir.entries('.').select { |f| f.downcase == basename.to_s.downcase } } dirname.cased_path.join(files.size == 1 ? files.first : basename) end
chdir(&block)
click to toggle source
# File lib/monkey/ext/pathname.rb, line 15 def chdir(&block) Dir.chdir(self.to_s, &block) end
open(mode = "r", &block)
click to toggle source
# File lib/monkey/ext/pathname.rb, line 19 def open(mode = "r", &block) File.open(self, mode, &block) end