Class: Dialog::Checklist
Overview
Displays a checklist
Corresponds to the --checklist box option. Use the choice method to define list items
Example:
steps = Dialog::checklist do |m|
m.text "Bla bla"
m.choice "/dev/hda1", "Backup partition /dev/hda1 using partimage", :on
m.choice "/dev/hda2", "Backup partition /dev/hda2 using dd", :off
end
Box option syntax:
--checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#choice(tag, item, status = :on, help = nil) ⇒ Object
Adds a choice to the checklist.
Methods inherited from Menu
#box_options, #initialize, #menu_height
Methods inherited from Base
#box_options, #box_type, #cancel?, #commandline_arguments, #common_options, #extra?, #handlers, #help?, #initialize, #method_missing, #no?, #ok?, #show, #show!, #wait, #yes?
Constructor Details
This class inherits a constructor from Dialog::Menu
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dialog::Base
Instance Method Details
#choice(tag, item, status = :on, help = nil) ⇒ Object
Adds a choice to the checklist
25 26 27 28 29 |
# File 'lib/checklist.rb', line 25 def choice(tag, item, status=:on, help=nil) choice = [tag, item, status.to_s] choice << help unless help.nil? @choices << choice end |