Class: HAStats::Responses::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/hastats/responses/text.rb

Instance Attribute Summary

Attributes inherited from Base

#parsed, #raw

Instance Method Summary collapse

Methods inherited from Base

#initialize, #to_json

Constructor Details

This class inherits a constructor from HAStats::Responses::Base

Instance Method Details

#parseObject



3
4
5
6
7
8
9
# File 'lib/hastats/responses/text.rb', line 3

def parse
  self.parsed = {}
  self.raw.split("\n").each do |line|
    name, value = line.split(/:/, 2)
    self.parsed[name.strip.downcase.to_sym] = value.strip if name && value
  end
end