Class: Paths::PathnameWrap
Instance Attribute Summary collapse
Instance Method Summary
collapse
#debug, #err, #error, #fatal, #info, #puts, #trace, #warn
Constructor Details
Returns a new instance of PathnameWrap.
70
71
72
73
74
|
# File 'lib/albacore/paths.rb', line 70
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
|
Instance Attribute Details
#inner ⇒ Object
65
66
67
|
# File 'lib/albacore/paths.rb', line 65
def inner
@inner
end
|
#p ⇒ Object
68
69
70
|
# File 'lib/albacore/paths.rb', line 68
def p
@p
end
|
Instance Method Details
#+(other) ⇒ Object
80
81
82
|
# File 'lib/albacore/paths.rb', line 80
def +(other)
join other
end
|
#==(o) ⇒ Object
Also known as:
eql?
93
94
95
96
|
# File 'lib/albacore/paths.rb', line 93
def ==(o)
trace { "#{self} ==( #{o} )" }
(o.respond_to? :p) && o.p == p
end
|
#as_unix ⇒ Object
unwraps the pathname; defaults all return forward slashes
105
106
107
|
# File 'lib/albacore/paths.rb', line 105
def as_unix
to_s.gsub /\\/, '/'
end
|
#hash ⇒ Object
100
101
102
|
# File 'lib/albacore/paths.rb', line 100
def hash
p.hash
end
|
#join(*other) ⇒ Object
84
85
86
87
|
# File 'lib/albacore/paths.rb', line 84
def join *other
args = other.collect { |x| x.is_a?(PathnameWrap) ? x.p : x }
PathnameWrap.new(inner.join(*args))
end
|
#parent ⇒ Object
76
77
78
|
# File 'lib/albacore/paths.rb', line 76
def parent
PathnameWrap.new(inner.parent)
end
|