Class: RDialogy::Base
- Inherits:
-
Object
- Object
- RDialogy::Base
- Defined in:
- lib/rdialogy/base.rb
Direct Known Subclasses
Calendar, Checklist, FilePathWidget, Form, Gauge, InfoBox, InputBox, InputMenu, Menu, MessageBox, MixedGauge, PasswordBox
Class Method Summary collapse
-
.run(options = {}, std_err = false) ⇒ Object
assembles the arguments for dialog and executes them, if std_err is true STDERR is captured and returned, optionally formatted by supplied block.
Class Method Details
.run(options = {}, std_err = false) ⇒ Object
assembles the arguments for dialog and executes them, if std_err is true STDERR is captured and returned, optionally formatted by supplied block.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rdialogy/base.rb', line 10 def self.run(={}, std_err = false) cmd = dialog_string if std_err begin tmp = Tempfile.new('tmp') cmd += ' 2> ' + tmp.path system cmd output = String.new while true output += tmp.readline end rescue EOFError if block_given? return yield output else return output end ensure tmp.close end else system cmd end end |