Class: Fulfillment::Models::Collection
- Inherits:
-
Object
- Object
- Fulfillment::Models::Collection
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/fulfillment/models/collection.rb
Instance Attribute Summary collapse
-
#_items ⇒ Object
readonly
Returns the value of attribute _items.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #[](value) ⇒ Object
-
#initialize(item_type, items) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(item_type, items) ⇒ Collection
Returns a new instance of Collection.
11 12 13 14 15 16 |
# File 'lib/fulfillment/models/collection.rb', line 11 def initialize(item_type, items) @_items = items @items = Array.wrap(_items).map do |item| item_type.new(item) end end |
Instance Attribute Details
#_items ⇒ Object (readonly)
Returns the value of attribute _items.
7 8 9 |
# File 'lib/fulfillment/models/collection.rb', line 7 def _items @_items end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
7 8 9 |
# File 'lib/fulfillment/models/collection.rb', line 7 def items @items end |
Instance Method Details
#[](value) ⇒ Object
18 19 20 |
# File 'lib/fulfillment/models/collection.rb', line 18 def [](value) items.force[value] end |