Class: Fountain::Funnels
- Inherits:
-
Object
- Object
- Fountain::Funnels
- Extended by:
- Forwardable
- Defined in:
- lib/fountain/funnels.rb
Overview
Fountain Funnel collection
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Collection current page.
-
#funnels ⇒ Object
readonly
Funnel collection.
-
#last_page ⇒ Object
readonly
Collection last page.
Instance Method Summary collapse
-
#initialize(data) ⇒ Funnels
constructor
A new instance of Funnels.
- #inspect ⇒ Object
Constructor Details
#initialize(data) ⇒ Funnels
Returns a new instance of Funnels.
24 25 26 27 28 29 30 31 32 |
# File 'lib/fountain/funnels.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 @funnels = raw_data['funnels'].map { |attr| Funnel.new attr } end |
Instance Attribute Details
#current_page ⇒ Object (readonly)
Collection current page
11 12 13 |
# File 'lib/fountain/funnels.rb', line 11 def current_page @current_page end |
#funnels ⇒ Object (readonly)
Funnel collection
17 18 19 |
# File 'lib/fountain/funnels.rb', line 17 def funnels @funnels end |
#last_page ⇒ Object (readonly)
Collection last page
14 15 16 |
# File 'lib/fountain/funnels.rb', line 14 def last_page @last_page end |
Instance Method Details
#inspect ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/fountain/funnels.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 |