Class: Gitlab::Graphql::Representation::TreeEntry

Inherits:
SimpleDelegator
  • Object
show all
Includes:
GlobalID::Identification
Defined in:
lib/gitlab/graphql/representation/tree_entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_entry, repository) ⇒ TreeEntry

Returns a new instance of TreeEntry.



25
26
27
28
29
# File 'lib/gitlab/graphql/representation/tree_entry.rb', line 25

def initialize(raw_entry, repository)
  @repository = repository

  super(raw_entry)
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



23
24
25
# File 'lib/gitlab/graphql/representation/tree_entry.rb', line 23

def repository
  @repository
end

Class Method Details

.decorate(entries, repository) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/graphql/representation/tree_entry.rb', line 10

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