lib/build/files/path.rb in build-files-1.0.2 vs lib/build/files/path.rb in build-files-1.0.3

- old
+ new

@@ -78,27 +78,25 @@ # 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 - def components - @components ||= @full_path.split(File::SEPARATOR) - end - - def basename - self.components.last - end - attr :root attr :full_path def length @full_path.length end - def parts - @parts ||= @full_path.split(File::SEPARATOR) + def components + @components ||= @full_path.split(File::SEPARATOR).freeze end + + def basename + self.parts.last + end + + alias parts components def relative_path @relative_path ||= Path.relative_path(@root.to_s, @full_path) end