Class: RailsLogParser::NotParseableLines
- Inherits:
-
Object
- Object
- RailsLogParser::NotParseableLines
- Defined in:
- lib/rails_log_parser/not_parseable_lines.rb
Instance Attribute Summary collapse
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
Instance Method Summary collapse
-
#initialize ⇒ NotParseableLines
constructor
A new instance of NotParseableLines.
- #push(line) ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize ⇒ NotParseableLines
Returns a new instance of NotParseableLines.
8 9 10 11 12 |
# File 'lib/rails_log_parser/not_parseable_lines.rb', line 8 def initialize @lines = [] @path = File.join(File.dirname(RailsLogParser::Parser.log_path), 'not_parseable_lines.json') load_file end |
Instance Attribute Details
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
6 7 8 |
# File 'lib/rails_log_parser/not_parseable_lines.rb', line 6 def lines @lines end |
Instance Method Details
#push(line) ⇒ Object
14 15 16 |
# File 'lib/rails_log_parser/not_parseable_lines.rb', line 14 def push(line) @lines.push(line) unless today_lines.include?(line) end |
#save ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rails_log_parser/not_parseable_lines.rb', line 18 def save @stats[Date.today.to_s] = today_lines + lines last_7_days = (0..6).map { |i| (Date.today - i) }.map(&:to_s) @stats.each_key do |key| @stats.delete(key) unless last_7_days.include?(key) end File.write(@path, @stats.to_json) end |