class Paths::PathnameWrap

Attributes

inner[R]

inner pathname

p[R]

string pathname

Public Class Methods

new(p) click to toggle source
# File lib/albacore/paths.rb, line 69
def initialize p
  raise ArgumentError, 'p is nil' if p.nil?
  @p = (p.is_a?(String) ? p : p.to_s)
  @inner = Pathname.new @p
end

Public Instance Methods

+(other) click to toggle source
# File lib/albacore/paths.rb, line 79
def +(other)
  join other
end
==(o) click to toggle source
# File lib/albacore/paths.rb, line 96
def ==(o)
  trace { "#{self} ==( #{o} )" }
  (o.respond_to? :p) && o.p == p
end
Also aliased as: eql?
as_unix() click to toggle source

unwraps the pathname; defaults all return forward slashes

# File lib/albacore/paths.rb, line 108
def as_unix
  to_s.gsub /\\/, '/'
end
eql?(o)
Alias for: ==
extname() click to toggle source
# File lib/albacore/paths.rb, line 92
def extname
  @inner.extname
end
hash() click to toggle source
# File lib/albacore/paths.rb, line 103
def hash
  p.hash
end
join(*other) click to toggle source
# File lib/albacore/paths.rb, line 83
def join *other
  args = other.collect { |x| x.is_a?(PathnameWrap) ? x.p : x }
  PathnameWrap.new(inner.join(*args))
end
parent() click to toggle source
# File lib/albacore/paths.rb, line 75
def parent
  PathnameWrap.new(inner.parent)
end
to_s() click to toggle source
# File lib/albacore/paths.rb, line 88
def to_s
  ::Albacore::Paths.normalise_slashes p
end