Class: Alicorn::LogParser
- Inherits:
-
Object
- Object
- Alicorn::LogParser
- Defined in:
- lib/alicorn/log_parser.rb
Constant Summary collapse
- SAMPLE_REGEX =
/(?<sample_type>active|queued|calling|writing):\[(?<values>.+)\]/
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#samples ⇒ Object
Returns the value of attribute samples.
Instance Method Summary collapse
-
#initialize(file = "alicorn.log") ⇒ LogParser
constructor
A new instance of LogParser.
- #parse ⇒ Object
Constructor Details
#initialize(file = "alicorn.log") ⇒ LogParser
Returns a new instance of LogParser.
7 8 9 10 |
# File 'lib/alicorn/log_parser.rb', line 7 def initialize(file = "alicorn.log") self.filename = file self.samples = [] end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'lib/alicorn/log_parser.rb', line 3 def filename @filename end |
#samples ⇒ Object
Returns the value of attribute samples.
3 4 5 |
# File 'lib/alicorn/log_parser.rb', line 3 def samples @samples end |
Instance Method Details
#parse ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/alicorn/log_parser.rb', line 12 def parse f = File.open(filename) f.each do |line| sample_line(line) end samples end |