Class: RubyRich::Dialog
- Inherits:
-
Object
- Object
- RubyRich::Dialog
- Defined in:
- lib/ruby_rich/dialog.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#content ⇒ Object
Returns the value of attribute content.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title: "", content: "", buttons: ["OK"]) ⇒ Dialog
constructor
A new instance of Dialog.
-
#show ⇒ Object
主显示方法.
Constructor Details
#initialize(title: "", content: "", buttons: ["OK"]) ⇒ Dialog
Returns a new instance of Dialog.
5 6 7 8 9 10 11 |
# File 'lib/ruby_rich/dialog.rb', line 5 def initialize(title: "", content: "", buttons: ["OK"]) @title = title @content = content = @selected_index = 0 @result = nil end |
Instance Attribute Details
#buttons ⇒ Object
Returns the value of attribute buttons.
3 4 5 |
# File 'lib/ruby_rich/dialog.rb', line 3 def end |
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/ruby_rich/dialog.rb', line 3 def content @content end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/ruby_rich/dialog.rb', line 3 def title @title end |
Instance Method Details
#show ⇒ Object
主显示方法
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby_rich/dialog.rb', line 14 def show Console.raw do loop do Console.clear render handle_input(Console.get_key) break if @result end end @result end |