Class: RailsLogConverter::Parser
- Defined in:
- lib/rails_log_converter/parser.rb
Instance Attribute Summary collapse
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#last_line ⇒ Object
Returns the value of attribute last_line.
Class Method Summary collapse
Instance Method Summary collapse
- #current_entry ⇒ Object
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
- #parse_file ⇒ Object
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
12 13 14 |
# File 'lib/rails_log_converter/parser.rb', line 12 def initialize last_line = "not blank" end |
Instance Attribute Details
#file_path ⇒ Object
Returns the value of attribute file_path.
16 17 18 |
# File 'lib/rails_log_converter/parser.rb', line 16 def file_path @file_path end |
#last_line ⇒ Object
Returns the value of attribute last_line.
16 17 18 |
# File 'lib/rails_log_converter/parser.rb', line 16 def last_line @last_line end |
Class Method Details
.parse_file(file_path) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/rails_log_converter/parser.rb', line 4 def parse_file(file_path) parser = self.new() parser.file_path = file_path parser.parse_file parser end |
Instance Method Details
#current_entry ⇒ Object
18 19 20 |
# File 'lib/rails_log_converter/parser.rb', line 18 def current_entry @current_entry ||= RailsLogConverter::Entry.new() end |
#parse_file ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rails_log_converter/parser.rb', line 22 def parse_file raise "File #{file_path} is missing" unless File.exists?(file_path) UI.puts "Parsing File #{file_path}" File.open(file_path, 'r').each_line do |line| parse_line line.dup.chomp.strip end current_entry.save unless current_entry.controller.nil? end |