diff options
author | Nick Thomas <nick@gitlab.com> | 2019-06-05 15:44:53 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-05 15:44:53 +0000 |
commit | 327c7d5a07fa08276a52b6a2bfdf79eee812a2cd (patch) | |
tree | 0da14d9a65451f5c1937fb8679cab3ab9f4c7954 /lib/gitlab/graphql/representation/tree_entry.rb | |
parent | 86ff32da666c8d284ecff5987d42fa4dfed2ee9b (diff) | |
parent | 4644a2daf5ec5e86e2b2989f04e99e4f081f6fef (diff) | |
download | gitlab-ce-327c7d5a07fa08276a52b6a2bfdf79eee812a2cd.tar.gz |
Merge branch 'graphql-file-entry-url' into 'master'
Add web_url to tree entry in GraphQL API
See merge request gitlab-org/gitlab-ce!28646
Diffstat (limited to 'lib/gitlab/graphql/representation/tree_entry.rb')
-rw-r--r-- | lib/gitlab/graphql/representation/tree_entry.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/gitlab/graphql/representation/tree_entry.rb b/lib/gitlab/graphql/representation/tree_entry.rb new file mode 100644 index 00000000000..7ea83db5876 --- /dev/null +++ b/lib/gitlab/graphql/representation/tree_entry.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Gitlab + module Graphql + module Representation + class TreeEntry < SimpleDelegator + class << self + def decorate(entries, repository) + return if entries.nil? + + entries.map do |entry| + if entry.is_a?(TreeEntry) + entry + else + self.new(entry, repository) + end + end + end + end + + attr_accessor :repository + + def initialize(raw_entry, repository) + @repository = repository + + super(raw_entry) + end + end + end + end +end |