Class: Palaver::Form
Defined Under Namespace
Classes: Entry
Instance Method Summary collapse
-
#initialize(options) ⇒ Form
constructor
A new instance of Form.
- #show ⇒ Object
Methods inherited from Base
#height, #text, #width, #with_tempfile
Constructor Details
#initialize(options) ⇒ Form
Returns a new instance of Form.
7 8 9 10 11 12 13 |
# File 'lib/palaver/form.rb', line 7 def initialize() super() @entries = [] @form_height = nil @simple_display_width = nil @simple_text_length = nil end |
Instance Method Details
#show ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/palaver/form.rb', line 15 def show text_width = @entries.map { |e| e.text_width }.max @entries.each { |e| e.update_value_x text_width } cmd_intro = "dialog --form '#@text' #@height #@width #@form_height " cmd_entries = @entries.map { |e| e.to_cmd_s }.join(' ') result = nil with_tempfile do |tfpath| cmd = "#{cmd_intro} #{cmd_entries} 2> #{tfpath}" success = system cmd result = read_dialog_output tfpath end return result end |