Module: Momentum::ViewControllerModule

Included in:
ViewController
Defined in:
lib/motion-momentum-ios/controller/view_controller_module.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#class_titleObject

Returns the value of attribute class_title.



28
29
30
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 28

def class_title
  @class_title
end

#delegateObject

Returns the value of attribute delegate.



28
29
30
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 28

def delegate
  @delegate
end

#delegate_classObject

Returns the value of attribute delegate_class.



28
29
30
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 28

def delegate_class
  @delegate_class
end

#stylesheet_classObject

Returns the value of attribute stylesheet_class.



28
29
30
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 28

def stylesheet_class
  @stylesheet_class
end

#view_classObject

Returns the value of attribute view_class.



28
29
30
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 28

def view_class
  @view_class
end

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 4

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initObject



30
31
32
33
34
35
36
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 30

def init
  super
  self.view_class = find_related_class('View')
  self.delegate_class = find_related_class('Delegate')
  self.stylesheet_class = find_related_class('Stylesheet')
  self
end

#loadViewObject



38
39
40
41
42
43
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 38

def loadView
  self.view = self.view_class.new
  self.delegate = self.delegate_class.new
  self.view.delegate = self.delegate if self.view.class.instance_methods.include?(:delegate)
  self.view.dataSource = self.delegate if self.view.class.instance_methods.include?(:dataSource)
end

#titleObject



49
50
51
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 49

def title
  super || class_title
end

#viewWillAppear(animated) ⇒ Object



45
46
47
# File 'lib/motion-momentum-ios/controller/view_controller_module.rb', line 45

def viewWillAppear(animated)
  self.setup if self.class.instance_methods.include?(:setup)
end