Class: ActiveWindow::Controller

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_window/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



52
53
54
# File 'lib/active_window/controller.rb', line 52

def method_missing(name, *args, &block)
  application.send name, *args, &block
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



6
7
8
# File 'lib/active_window/controller.rb', line 6

def application
  @application
end

Instance Method Details

#appObject



8
9
10
# File 'lib/active_window/controller.rb', line 8

def app
  application
end

#controllerObject



16
17
18
# File 'lib/active_window/controller.rb', line 16

def controller
  application.controller
end

#databaseObject



24
25
26
# File 'lib/active_window/controller.rb', line 24

def database
  application.database
end

#post_setupObject

called on startup, after setup has been called for all controllers



33
34
# File 'lib/active_window/controller.rb', line 33

def post_setup
end

#pref_get(key) ⇒ Object



42
43
44
45
46
# File 'lib/active_window/controller.rb', line 42

def pref_get(key)
  pref = Preference.find_by_pref(key)
  return pref.value if pref
  return nil
end

#pref_get_or_set(key, value) ⇒ Object



48
49
50
# File 'lib/active_window/controller.rb', line 48

def pref_get_or_set(key,value)
  pref_get(key) || pref_set(key,value)
end

#pref_set(key, value) ⇒ Object



36
37
38
39
40
# File 'lib/active_window/controller.rb', line 36

def pref_set(key,value)
  Preference.delete_all ['pref = ?', key]
  Preference.create(:pref => key, :value => value)
  value
end

#setupObject

called on startup



29
30
# File 'lib/active_window/controller.rb', line 29

def setup
end

#widget(name) ⇒ Object



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

def widget(name)
  application.widget(name)
end

#windowObject



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

def window
  application.window
end