Class: UnderOs::UI::Locker
- Inherits:
-
View
- Object
- View
- UnderOs::UI::Locker
- Defined in:
- lib/under_os/ui/locker.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#spinner ⇒ Object
readonly
Returns the value of attribute spinner.
Instance Method Summary collapse
- #hide ⇒ Object
-
#initialize(options = {}) ⇒ Locker
constructor
A new instance of Locker.
- #show ⇒ Object
- #show_for(&block) ⇒ Object
- #text ⇒ Object
- #text=(text) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Locker
Returns a new instance of Locker.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/under_os/ui/locker.rb', line 6 def initialize(={}) super @dialog = UnderOs::UI::View.new(class: 'locker-dialog') @spinner = UnderOs::UI::Spinner.new @label = UnderOs::UI::Label.new(text: [:text] || '') append @dialog.append(@spinner, @label) addClass 'with-label' if [:text] end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/under_os/ui/locker.rb', line 4 def label @label end |
#spinner ⇒ Object (readonly)
Returns the value of attribute spinner.
4 5 6 |
# File 'lib/under_os/ui/locker.rb', line 4 def spinner @spinner end |
Instance Method Details
#hide ⇒ Object
23 24 25 |
# File 'lib/under_os/ui/locker.rb', line 23 def hide remove end |
#show ⇒ Object
18 19 20 21 |
# File 'lib/under_os/ui/locker.rb', line 18 def show insertTo(UnderOs::App.history.current_page.view) if ! parent repaint end |
#show_for(&block) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/under_os/ui/locker.rb', line 35 def show_for(&block) show 1.ms.later do block.call 1.ms.later { hide } end end |
#text ⇒ Object
27 28 29 |
# File 'lib/under_os/ui/locker.rb', line 27 def text @label.text end |
#text=(text) ⇒ Object
31 32 33 |
# File 'lib/under_os/ui/locker.rb', line 31 def text=(text) @label.text = text end |