class Controller

Controller

Implements a basic structure for a Shot MVC Controller

Shot Framework - Copyright © Jesse Aaron Dunlap <me@jessedunlap.me> Licensed under the MIT License. For full licensing information, please see LICENSE.md. github.com/JesseDunlap/shot/

Attributes

app[RW]

Application instance to which the controller belongs

view_private[RW]

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

Public Class Methods

new(app) click to toggle source

Instantiate the controller and keep track of the passed ApplicationInstance

# File lib/shot_mvc/controller.rb, line 19
def initialize(app)
        @view_private = []
        @app = app
end

Public Instance Methods

add_private_action(action) click to toggle source

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

Attributes

  • action - String name of a controller method

# File lib/shot_mvc/controller.rb, line 30
def add_private_action(action)
        view_private.push action
end
e(selector) click to toggle source

Instantiate a new Element, assigned to the specified query

Note

Sugary way of writing +get “element”, “selector”+

# File lib/shot_mvc/controller.rb, line 46
def e(selector)
        @app.get 'element', selector
end
get(type, name) click to toggle source

Utilize a Loader.

Note

This is a convenient access method for ApplicationInstance#get

# File lib/shot_mvc/controller.rb, line 38
def get(type, name)
        @app.get type, name
end