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.
-
#postprocessor ⇒ Object
readonly
Returns the value of attribute postprocessor.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Tool
constructor
A new instance of Tool.
- #run ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Tool
Returns a new instance of Tool.
7 8 9 10 11 12 13 14 |
# File 'lib/statsd_test_harness/tool.rb', line 7 def initialize(attrs={}) @name = attrs[:name] @command = attrs[:command] @options = attrs[:options] @label = attrs[:label] @postprocessor = attrs[:postprocessor] @ignore_return_value = attrs[:ignore_return_value] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def command @command end |
#ignore_return_value ⇒ Object (readonly)
Returns the value of attribute ignore_return_value.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def ignore_return_value @ignore_return_value end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def label @label end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def @options end |
#postprocessor ⇒ Object (readonly)
Returns the value of attribute postprocessor.
5 6 7 |
# File 'lib/statsd_test_harness/tool.rb', line 5 def postprocessor @postprocessor end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/statsd_test_harness/tool.rb', line 16 def run output = `#{self.command} #{self.}` puts output data = self.postprocessor.new(output) if $?.to_i > 0 && ! ignore_return_value raise "Test run returned non-zero status, results not submitted." end data end |