mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 14:46:05 +10:00
Add new methods to StringPath
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user