Class: MotionPrime::PageViewDelegate

Inherits:
Object
  • Object
show all
Includes:
DelegateMixin
Defined in:
motion-prime/sections/page_view/page_view_delegate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DelegateMixin

#clear_delegated, #delegated_by

Constructor Details

#initialize(options) ⇒ PageViewDelegate

Returns a new instance of PageViewDelegate.



6
7
8
9
10
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 6

def initialize(options)
  self.collection_section = options[:section].try(:weak_ref)
  @_section_info = collection_section.to_s
  @section_instance = collection_section.to_s
end

Instance Attribute Details

#collection_sectionObject

Returns the value of attribute collection_section.



4
5
6
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 4

def collection_section
  @collection_section
end

Instance Method Details

#deallocObject



12
13
14
15
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 12

def dealloc
  Prime.logger.dealloc_message :collection_delegate, @_section_info
  super
end

#pageViewController(pvc, willTransitionToViewControllers: pending_view_controllers) ⇒ Object



21
22
23
24
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 21

def pageViewController(pvc, viewControllerBeforeViewController:vc)
  index = collection_section.index_for_page(vc)
  collection_section.page_for_index(index - 1)
end

#presentationCountForPageViewController(controller) ⇒ Object



31
32
33
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 31

def presentationCountForPageViewController(controller)
  collection_section.data.size
end

#viewControllerAtIndex(index, storyboard: storyboard) ⇒ Object



17
18
19
# File 'motion-prime/sections/page_view/page_view_delegate.rb', line 17

def viewControllerAtIndex(index, storyboard:storyboard)
  collection_section.page_for_index(index)
end