Class: Zombees::AbAdapter::Parser
- Inherits:
-
Object
- Object
- Zombees::AbAdapter::Parser
- Defined in:
- lib/zombees/ab_adapter.rb
Instance Attribute Summary collapse
-
#command_results ⇒ Object
readonly
Returns the value of attribute command_results.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(command_results) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(command_results) ⇒ Parser
Returns a new instance of Parser.
98 99 100 |
# File 'lib/zombees/ab_adapter.rb', line 98 def initialize(command_results) @command_results = command_results end |
Instance Attribute Details
#command_results ⇒ Object (readonly)
Returns the value of attribute command_results.
97 98 99 |
# File 'lib/zombees/ab_adapter.rb', line 97 def command_results @command_results end |
Class Method Details
.parse(output) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/zombees/ab_adapter.rb', line 108 def self.parse(output) output.each_line.each_with_object({}) do |line, data| key, value = line.strip.split(/\s*:\s*/) if key key += " concurrent" if value =~ /concurrent/ data[key.downcase.gsub(/\s+/, '_').to_sym] = value.to_f end end end |
Instance Method Details
#parse ⇒ Object
102 103 104 105 106 |
# File 'lib/zombees/ab_adapter.rb', line 102 def parse command_results.flatten.map do |command| self.class.parse(command.stdout) end end |