Class: Katello::RepositoryPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/katello/repository_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ RepositoryPresenter

Returns a new instance of RepositoryPresenter.



5
6
7
# File 'app/presenters/katello/repository_presenter.rb', line 5

def initialize(repository)
  @repository = repository
end

Instance Attribute Details

#repositoryObject

Returns the value of attribute repository.



3
4
5
# File 'app/presenters/katello/repository_presenter.rb', line 3

def repository
  @repository
end

Instance Method Details

#content_view_environmentsObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/presenters/katello/repository_presenter.rb', line 9

def content_view_environments
  unarchived = @repository.clones.select { |clone| clone.environment && clone.content_view_version }

  unarchived.collect do |repository|
    if repository.environment && repository.content_view_version
      {
        :content_view_version => {
          :id => repository.content_view_version.id,
          :name => repository.content_view_version.name
        },
        :environment => {
          :id => repository.environment.id,
          :name => repository.environment.name
        }
      }
    end
  end
end