Add new methods to StringPath

This commit is contained in:
Grzegorz Bizon
2016-01-14 12:48:12 +01:00
parent f5d5308658
commit 73d2c7a553
2 changed files with 49 additions and 3 deletions
+17 -2
View File
@@ -7,11 +7,17 @@ module Gitlab
#
#
class StringPath
attr_reader :path, :universe
def initialize(path, universe)
@path = path
@universe = universe
end
def to_s
@path
end
def absolute?
@path.start_with?('/')
end
@@ -28,8 +34,17 @@ module Gitlab
!directory?
end
def to_s
@path
def files
raise NotImplementedError
end
def basename
name = @path.split(::File::SEPARATOR).last
directory? ? name + ::File::SEPARATOR : name
end
def ==(other)
@path == other.path && @universe == other.universe
end
end
end