Class: Katello::ContentViewVersionComparePresenter
- Inherits:
-
Object
- Object
- Katello::ContentViewVersionComparePresenter
show all
- Defined in:
- app/presenters/katello/content_view_version_compare_presenter.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ContentViewVersionComparePresenter.
3
4
5
6
7
|
# File 'app/presenters/katello/content_view_version_compare_presenter.rb', line 3
def initialize(content_item, content_view_versions, repository)
@item = content_item
@versions = content_view_versions
@repository = repository
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
25
26
27
|
# File 'app/presenters/katello/content_view_version_compare_presenter.rb', line 25
def method_missing(*args, &block)
@item.send(*args, &block)
end
|
Instance Method Details
#comparison ⇒ Object
9
10
11
12
13
14
|
# File 'app/presenters/katello/content_view_version_compare_presenter.rb', line 9
def comparison
item_repos = @item.repositories
item_repos.where(:library_instance_id => @repository.id) if @repository
item_repos.map(&:content_view_version_id) & @versions.map(&:id)
end
|
#comparison_repositories ⇒ Object
16
17
18
19
|
# File 'app/presenters/katello/content_view_version_compare_presenter.rb', line 16
def comparison_repositories
repo = @item
@versions.map(&:id) & repo&.published_in_versions&.pluck(:id)
end
|
#respond_to?(method) ⇒ Boolean
21
22
23
|
# File 'app/presenters/katello/content_view_version_compare_presenter.rb', line 21
def respond_to?(method)
return method.to_s == 'comparison' || @item.respond_to?(method)
end
|