Class: HandyToolbox::Cmd
- Inherits:
-
Object
- Object
- HandyToolbox::Cmd
- Defined in:
- lib/handy_toolbox/cmd.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(cmd) ⇒ Cmd
constructor
A new instance of Cmd.
Constructor Details
#initialize(cmd) ⇒ Cmd
Returns a new instance of Cmd.
7 8 9 |
# File 'lib/handy_toolbox/cmd.rb', line 7 def initialize(cmd) @cmd = cmd end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/handy_toolbox/cmd.rb', line 5 def output @output end |
Class Method Details
Instance Method Details
#exec ⇒ Object
15 16 17 18 19 20 |
# File 'lib/handy_toolbox/cmd.rb', line 15 def exec @output = `#{@cmd} 2> /dev/null`.rstrip if ok? output end end |