diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-31 12:21:56 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:15 +0100 |
commit | 3de8a4620a70c886c815576dc0a30a745cbb8ccb (patch) | |
tree | 7cad0174855a338bab620068f005f78fa804fce7 /lib | |
parent | 447f56036e837fc9a9c2bcaf382d38dc513a9733 (diff) | |
download | gitlab-ce-3de8a4620a70c886c815576dc0a30a745cbb8ccb.tar.gz |
Parse artifacts metadata stored in JSON format
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/string_path.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/gitlab/string_path.rb b/lib/gitlab/string_path.rb index bfeb0f852f0..ad68a8ff2d6 100644 --- a/lib/gitlab/string_path.rb +++ b/lib/gitlab/string_path.rb @@ -10,10 +10,11 @@ module Gitlab class StringPath attr_reader :path, :universe - def initialize(path, universe) + def initialize(path, universe, metadata = []) @path = prepare(path) - @universe = Set.new(universe.map { |entry| prepare(entry) }) - @universe.add('./') + @universe = universe.map { |entry| prepare(entry) } + @universe << './' unless @universe.include?('./') + @metadata = metadata end def to_s @@ -84,6 +85,11 @@ module Gitlab children.select(&:file?) end + def metadata + index = @universe.index(@path) + @metadata[index] + end + def ==(other) @path == other.path && @universe == other.universe end |