Class: Fountain::Slots
- Inherits:
-
Object
- Object
- Fountain::Slots
- Extended by:
- Forwardable
- Defined in:
- lib/fountain/slots.rb
Overview
Fountain Slot collection
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Collection current page.
-
#last_page ⇒ Object
readonly
Collection last page.
-
#slots ⇒ Object
readonly
Slot collection.
Instance Method Summary collapse
-
#initialize(data) ⇒ Slots
constructor
A new instance of Slots.
- #inspect ⇒ Object
Constructor Details
#initialize(data) ⇒ Slots
Returns a new instance of Slots.
24 25 26 27 28 29 30 31 32 |
# File 'lib/fountain/slots.rb', line 24 def initialize(data) raw_data = Util.stringify_hash_keys data pagination = raw_data['pagination'] if pagination.is_a? Hash @current_page = pagination['current'] @last_page = pagination['last'] end @slots = raw_data['slots'].map { |attr| Slot.new attr } end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Collection current page
11 12 13 |
# File 'lib/fountain/slots.rb', line 11 def current_page @current_page end |
#last_page ⇒ Object (readonly)
Collection last page
14 15 16 |
# File 'lib/fountain/slots.rb', line 14 def last_page @last_page end |
#slots ⇒ Object (readonly)
Slot collection
17 18 19 |
# File 'lib/fountain/slots.rb', line 17 def slots @slots end |
Instance Method Details
#inspect ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/fountain/slots.rb', line 34 def inspect format( '#<%<class_name>s:0x%<object_id>p @count="%<count>s">', class_name: self.class.name, object_id: object_id, count: count ) end |