Class: Mousevc::App

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ App

Creates a new Mousevc::App instance



54
55
56
57
58
59
60
61
# File 'lib/mousevc/app.rb', line 54

def initialize(options={})
  @controller = options[:controller]
  @model = options[:model]
  @action = options[:action]
  @views = options[:views]
  @looping = options[:looping].nil? ? false : options[:looping]
  @system_clear = options[:system_clear].nil? ? false : options[:system_clear]
end

Instance Attribute Details

#loopingBoolean

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

#routerMousevc::Router

Returns the current router



41
42
43
# File 'lib/mousevc/app.rb', line 41

def router
  @router
end

#system_clearBoolean

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



85
86
87
# File 'lib/mousevc/app.rb', line 85

def looping?
  @looping
end

#runObject

Runs the application



66
67
68
69
70
71
# File 'lib/mousevc/app.rb', line 66

def run
  reset
  @looping ? listen : single
  Input.clear
  nil
end

#system_clear?Boolean

Returns true if @system_clear is true



78
79
80
# File 'lib/mousevc/app.rb', line 78

def system_clear?
  @system_clear
end