Class: StatsdTestHarness::Tool
- Inherits:
-
Object
- Object
- StatsdTestHarness::Tool
- Defined in:
- lib/statsd_test_harness/tool.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#ignore_return_value ⇒ Object
readonly
Returns the value of attribute ignore_return_value.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #exit_status ⇒ Object
-
#initialize(attrs = {}) ⇒ Tool
constructor
A new instance of Tool.
- #run ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Tool
Returns a new instance of Tool.
6 7 8 9 10 11 12 |
# File 'lib/statsd_test_harness/tool.rb', line 6 def initialize(attrs={}) @name = attrs[:name] @command = attrs[:command] @options = attrs[:options] @label = attrs[:label] @ignore_return_value = attrs[:ignore_return_value] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/statsd_test_harness/tool.rb', line 4 def command @command end |
#ignore_return_value ⇒ Object (readonly)
Returns the value of attribute ignore_return_value.
4 5 6 |
# File 'lib/statsd_test_harness/tool.rb', line 4 def ignore_return_value @ignore_return_value end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
4 5 6 |
# File 'lib/statsd_test_harness/tool.rb', line 4 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/statsd_test_harness/tool.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/statsd_test_harness/tool.rb', line 4 def @options end |
Instance Method Details
#exit_status ⇒ Object
21 22 23 |
# File 'lib/statsd_test_harness/tool.rb', line 21 def exit_status $?.exitstatus end |
#run ⇒ Object
14 15 16 17 18 19 |
# File 'lib/statsd_test_harness/tool.rb', line 14 def run cmd = open("| #{self.command} #{self.}") cmd.each_line{ |io| print io } cmd.close exit_status end |