Class: Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/shot_mvc/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Controller

Instantiate the controller and keep track of the passed ApplicationInstance



19
20
21
22
# File 'lib/shot_mvc/controller.rb', line 19

def initialize(app)
	@view_private = []
	@app = app
end

Instance Attribute Details

#appObject

Application instance to which the controller belongs



12
13
14
# File 'lib/shot_mvc/controller.rb', line 12

def app
  @app
end

#view_privateObject

An array of actions which can not be called from a view



15
16
17
# File 'lib/shot_mvc/controller.rb', line 15

def view_private
  @view_private
end

Instance Method Details

#add_private_action(action) ⇒ Object

Adds an action to the list of private, non-view-callable actions

Attributes

  • action - String name of a controller method



30
31
32
# File 'lib/shot_mvc/controller.rb', line 30

def add_private_action(action)
	view_private.push action
end

#get(type, name) ⇒ Object

Utilize a Loader.

Note

This is a convenient access method for ApplicationInstance#get



38
39
40
# File 'lib/shot_mvc/controller.rb', line 38

def get(type, name)
	@app.get type, name
end