Class: Mousevc::App
- Inherits:
-
Object
- Object
- Mousevc::App
- Defined in:
- lib/mousevc/app.rb
Overview
true The top level class of Mousevc. The container for all of the objects created within a Mousevc application.
Instance Attribute Summary collapse
-
#looping ⇒ Boolean
Set this to
trueif you want the application to loop, defaults tofalse. -
#router ⇒ Mousevc::Router
Returns the current router.
-
#system_clear ⇒ Boolean
Setting this to
falsewill disable calls to system(‘clear’) at the start of each application loop.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ App
constructor
Creates a new
Mousevc::Appinstance. -
#looping? ⇒ Boolean
Returns
trueif @looping is set totrue. -
#run ⇒ Object
Runs the application.
-
#system_clear? ⇒ Boolean
Returns
trueif @system_clear is true.
Constructor Details
#initialize(options = {}) ⇒ App
as of v0.0.6 Mousevc requires that the views path be absolute, e.g “#{File.dirname(__FILE__)}/views”
Creates a new Mousevc::App instance
56 57 58 59 60 61 62 63 |
# File 'lib/mousevc/app.rb', line 56 def initialize(={}) @controller = [:controller] @model = [:model] @action = [:action] @views = [:views] @looping = [:looping].nil? ? false : [:looping] @system_clear = [:system_clear].nil? ? false : [:system_clear] end |
Instance Attribute Details
#looping ⇒ Boolean
Set this to true if you want the application to loop, defaults to false
32 33 34 |
# File 'lib/mousevc/app.rb', line 32 def looping @looping end |
#router ⇒ Mousevc::Router
Returns the current router
41 42 43 |
# File 'lib/mousevc/app.rb', line 41 def router @router end |
#system_clear ⇒ Boolean
Setting this to false will disable calls to system(‘clear’) at the start of each application loop.
23 24 25 |
# File 'lib/mousevc/app.rb', line 23 def system_clear @system_clear end |
Instance Method Details
#looping? ⇒ Boolean
Returns true if @looping is set to true
87 88 89 |
# File 'lib/mousevc/app.rb', line 87 def looping? @looping end |
#run ⇒ Object
Runs the application
68 69 70 71 72 73 |
# File 'lib/mousevc/app.rb', line 68 def run reset @looping ? listen : single Input.clear nil end |
#system_clear? ⇒ Boolean
Returns true if @system_clear is true
80 81 82 |
# File 'lib/mousevc/app.rb', line 80 def system_clear? @system_clear end |