diff options
author | Phil Hughes <me@iamphill.com> | 2019-06-04 16:38:18 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-06-05 10:46:32 +0300 |
commit | 4644a2daf5ec5e86e2b2989f04e99e4f081f6fef (patch) | |
tree | 40c9376ce43f2c2b9d964fb67b1c35cfb0077773 /lib/gitlab/graphql | |
parent | df549eb28c83b27500619ccb14c201a4ff87daa3 (diff) |
Add web_url to tree entry in GraphQL API
Diffstat (limited to 'lib/gitlab/graphql')
-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 |