Class: Ey::Logger::MachineParser
- Inherits:
-
Object
- Object
- Ey::Logger::MachineParser
- Defined in:
- lib/ey/logger/machine_parser.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tag, data) ⇒ MachineParser
constructor
A new instance of MachineParser.
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
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/ey/logger/machine_parser.rb', line 7 def data @data end |
#tag ⇒ Object (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 |