Class: Opine::Application

Inherits:
Widget
  • Object
show all
Defined in:
lib/opine/widgets/alert.rb,
lib/opine/widgets/window.rb,
lib/opine/widgets/application.rb

Direct Known Subclasses

Native::Application

Constant Summary collapse

DEFAULTS =
{ :theme => :native }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Widget

#initialize

Constructor Details

This class inherits a constructor from Opine::Widget

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



2
3
4
# File 'lib/opine/widgets/application.rb', line 2

def application
  @application
end

Class Method Details

.themeObject



12
13
14
# File 'lib/opine/widgets/application.rb', line 12

def self.theme
  @@theme
end

Instance Method Details

#alert(text, options = {}, &block) ⇒ Object



6
7
8
# File 'lib/opine/widgets/alert.rb', line 6

def alert(text, options={}, &block)
  "Opine::#{theme.to_s.camelize}::Alert".constantize.new(options.merge(:application => application, :text => text),&block)
end

#themeObject



6
7
8
# File 'lib/opine/widgets/application.rb', line 6

def theme
  @@theme
end

#theme=(theme) ⇒ Object



9
10
11
# File 'lib/opine/widgets/application.rb', line 9

def theme= theme
  @@theme = theme
end

#window(options = {}, &block) ⇒ Object



12
13
14
# File 'lib/opine/widgets/window.rb', line 12

def window(options={},&block)
  "Opine::#{theme.to_s.camelize}::Window".constantize.new(Opine::Window::DEFAULTS.merge(options),&block)
end