Class: Tarpon::Entity::EntitlementList
- Inherits:
-
Object
- Object
- Tarpon::Entity::EntitlementList
- Includes:
- Enumerable
- Defined in:
- lib/tarpon/entity/entitlement_list.rb
Instance Method Summary collapse
- #[](index) ⇒ Object
- #active ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(entitlements = {}) ⇒ EntitlementList
constructor
A new instance of EntitlementList.
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 |
#active ⇒ Object
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 |