Class: StatsdTestHarness::Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/statsd_test_harness/tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commandObject (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_valueObject (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

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'lib/statsd_test_harness/tool.rb', line 4

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/statsd_test_harness/tool.rb', line 4

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/statsd_test_harness/tool.rb', line 4

def options
  @options
end

Instance Method Details

#exit_statusObject



21
22
23
# File 'lib/statsd_test_harness/tool.rb', line 21

def exit_status
  $?.exitstatus
end

#runObject



14
15
16
17
18
19
# File 'lib/statsd_test_harness/tool.rb', line 14

def run
  cmd = open("| #{self.command} #{self.options}")
  cmd.each_line{ |io| print io }
  cmd.close
  exit_status
end