lib/build/files/path.rb in build-files-1.4.3 vs lib/build/files/path.rb in build-files-1.4.4
- old
+ new
@@ -87,13 +87,10 @@
@relative_path = relative_path
else
# Effectively dirname and basename:
@root, _, @relative_path = full_path.rpartition(File::SEPARATOR)
end
-
- # This improves the cost of hash/eql? slightly but the root cannot be deconstructed if it was an instance of Path.
- # @root = @root.to_s
end
attr :root
attr :full_path
@@ -114,11 +111,11 @@
end
alias parts components
def relative_path
- @relative_path ||= Path.relative_path(@root.to_s, @full_path).freeze
+ @relative_path ||= Path.relative_path(@root.to_s, @full_path.to_s).freeze
end
def relative_parts
dirname, _, basename = self.relative_path.rpartition(File::SEPARATOR)
@@ -188,18 +185,19 @@
def shortest_path(root)
self.class.shortest_path(self, root)
end
def to_str
- @full_path
+ @full_path.to_str
end
def to_path
@full_path
end
def to_s
- @full_path
+ # It's not guaranteed to be string.
+ @full_path.to_s
end
def inspect
"#{@root.inspect}/#{relative_path.inspect}"
end