Class: Terraform::ModuleVersionPresenter

Inherits:
Gitlab::View::Presenter::Simple show all
Defined in:
app/presenters/terraform/module_version_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

#initialize(package, system) ⇒ ModuleVersionPresenter

Returns a new instance of ModuleVersionPresenter.


7
8
9
10
# File 'app/presenters/terraform/module_version_presenter.rb', line 7

def initialize(package, system)
  @package = package
  @system = system
end

Instance Attribute Details

#packageObject

Returns the value of attribute package.


5
6
7
# File 'app/presenters/terraform/module_version_presenter.rb', line 5

def package
  @package
end

#systemObject

Returns the value of attribute system.


5
6
7
# File 'app/presenters/terraform/module_version_presenter.rb', line 5

def system
  @system
end

Instance Method Details

#nameObject


12
13
14
# File 'app/presenters/terraform/module_version_presenter.rb', line 12

def name
  package.name
end

#providerObject


16
17
18
# File 'app/presenters/terraform/module_version_presenter.rb', line 16

def provider
  system
end

#providersObject


20
21
22
23
24
# File 'app/presenters/terraform/module_version_presenter.rb', line 20

def providers
  [
    provider
  ]
end

#rootObject


26
27
28
29
30
# File 'app/presenters/terraform/module_version_presenter.rb', line 26

def root
  {
    'dependencies' => []
  }
end

#sourceObject


32
33
34
# File 'app/presenters/terraform/module_version_presenter.rb', line 32

def source
  package&.project&.web_url
end

#submodulesObject


36
37
38
# File 'app/presenters/terraform/module_version_presenter.rb', line 36

def submodules
  []
end

#versionObject


40
41
42
# File 'app/presenters/terraform/module_version_presenter.rb', line 40

def version
  package.version
end

#versionsObject


44
45
46
47
48
# File 'app/presenters/terraform/module_version_presenter.rb', line 44

def versions
  [
    version
  ]
end