Class: RDialogy::InputMenu
Class Method Summary collapse
-
.args(options = {}) ⇒ Object
Formats the hash into an ordered list, valid options are: * :text - Title of the widget * :width * :height * :list_height - Number of items to display in the list * :items - Array of MenuItem.
-
.command ⇒ Object
Maps to the appropriate dialog argument.
- .run(options = {}) ⇒ Object
Class Method Details
.args(options = {}) ⇒ Object
Formats the hash into an ordered list, valid options are:
-
:text - Title of the widget
-
:width
-
:height
-
:list_height - Number of items to display in the list
-
:items - Array of MenuItem
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rdialogy/inputmenu.rb', line 24 def self.args(={}) [:items] ||= [] [:list_height] ||= [:items].count * 3 [:items].map! do |item| [item.tag, item.item] end super + [[:list_height]] + [:items].flatten end |
.command ⇒ Object
Maps to the appropriate dialog argument
36 37 38 |
# File 'lib/rdialogy/inputmenu.rb', line 36 def self.command 'inputmenu' end |
.run(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rdialogy/inputmenu.rb', line 7 def self.run(={}) super , true do |input| if input =~ /^RENAMED/ input.split(' ')[1..-1] else input.chomp end end end |