Class: Gitlab::Graphql::Representation::SubmoduleTreeEntry

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(submodule, submodule_links) ⇒ SubmoduleTreeEntry

Returns a new instance of SubmoduleTreeEntry.



20
21
22
23
24
# File 'lib/gitlab/graphql/representation/submodule_tree_entry.rb', line 20

def initialize(submodule, submodule_links)
  @submodule_links = submodule_links

  super(submodule)
end

Class Method Details

.decorate(submodules, tree) ⇒ Object



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

def decorate(submodules, tree)
  repository = tree.repository
  submodule_links = Gitlab::SubmoduleLinks.new(repository)

  submodules.map do |submodule|
    self.new(submodule, submodule_links.for(submodule, tree.sha))
  end
end

Instance Method Details

#tree_urlObject



30
31
32
# File 'lib/gitlab/graphql/representation/submodule_tree_entry.rb', line 30

def tree_url
  @submodule_links&.tree
end

#web_urlObject



26
27
28
# File 'lib/gitlab/graphql/representation/submodule_tree_entry.rb', line 26

def web_url
  @submodule_links&.web
end