Class: Pathname

Inherits:
Object show all
Defined in:
lib/pik/core_ext/pathname.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



25
26
27
28
29
30
# File 'lib/pik/core_ext/pathname.rb', line 25

def ==(other)
  return false unless Pathname === other
  self_ = self.dup.to_ruby.downcase
  other = other.dup.to_ruby.downcase
  self_ == other
end

#rubyObject



17
18
19
# File 'lib/pik/core_ext/pathname.rb', line 17

def ruby
  Pathname(self.to_ruby)
end

#to_bashObject



13
14
15
# File 'lib/pik/core_ext/pathname.rb', line 13

def to_bash
  @path.tr('\\','/').sub(/^(.):/){|s| "/#{s[0,1].downcase}"}
end

#to_rubyObject



9
10
11
# File 'lib/pik/core_ext/pathname.rb', line 9

def to_ruby
  @path.tr('\\','/').sub(/^(.):/){|s| s.upcase }
end

#to_sObject Also known as: to_windows



4
5
6
# File 'lib/pik/core_ext/pathname.rb', line 4

def to_s
  @path.tr('/','\\').sub(/^(.):/){|s| s.upcase }
end

#windowsObject



21
22
23
# File 'lib/pik/core_ext/pathname.rb', line 21

def windows
  Pathname(self.to_s)
end