Class: Ey::Logger::MachineParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ey/logger/machine_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, data) ⇒ MachineParser

Returns a new instance of MachineParser.



9
10
11
# File 'lib/ey/logger/machine_parser.rb', line 9

def initialize(tag, data)
  @tag, @data = tag, data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/ey/logger/machine_parser.rb', line 7

def data
  @data
end

#tagObject (readonly)

Returns the value of attribute tag.



7
8
9
# File 'lib/ey/logger/machine_parser.rb', line 7

def tag
  @tag
end

Class Method Details

.parse(line) ⇒ Object



2
3
4
5
# File 'lib/ey/logger/machine_parser.rb', line 2

def self.parse(line)
  tag, data = line.match(/\A\[(\S+)\]\s+(\{.*\})\z/).captures
  new(tag, JSON.load(data))
end