Class: Katello::HostSubscriptionsPresenter
- Inherits:
-
Object
- Object
- Katello::HostSubscriptionsPresenter
- Defined in:
- app/presenters/katello/host_subscriptions_presenter.rb
Instance Attribute Summary collapse
-
#subscriptions ⇒ Object
readonly
Returns the value of attribute subscriptions.
Instance Method Summary collapse
-
#initialize(host) ⇒ HostSubscriptionsPresenter
constructor
A new instance of HostSubscriptionsPresenter.
Constructor Details
#initialize(host) ⇒ HostSubscriptionsPresenter
Returns a new instance of HostSubscriptionsPresenter.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/presenters/katello/host_subscriptions_presenter.rb', line 5 def initialize(host) pools = host.subscription_facet&.pools || [] @pools = pools.group_by(&:cp_id) entitlements = host.subscription_facet.candlepin_consumer.entitlements if @pools.any? entitlements ||= [] @subscriptions = entitlements.map do |e| HostSubscriptionPresenter.new(pool: pool_for_entitlement(e), entitlement: e) end end |
Instance Attribute Details
#subscriptions ⇒ Object (readonly)
Returns the value of attribute subscriptions.
3 4 5 |
# File 'app/presenters/katello/host_subscriptions_presenter.rb', line 3 def subscriptions @subscriptions end |