Class: Tarpon::Entity::EntitlementList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/tarpon/entity/entitlement_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(entitlements = {}) ⇒ EntitlementList

Returns a new instance of EntitlementList.



8
9
10
# File 'lib/tarpon/entity/entitlement_list.rb', line 8

def initialize(entitlements = {})
  @entitlements = entitlements.map { |id, params| Entitlement.new(id, params) }
end

Instance Method Details

#[](index) ⇒ Object



12
13
14
# File 'lib/tarpon/entity/entitlement_list.rb', line 12

def [](index)
  @entitlements[index]
end

#activeObject



16
17
18
# File 'lib/tarpon/entity/entitlement_list.rb', line 16

def active
  @entitlements.select(&:active?)
end

#each(&block) ⇒ Object



20
21
22
# File 'lib/tarpon/entity/entitlement_list.rb', line 20

def each(&block)
  @entitlements.each(&block)
end