Class: Reading::Parsing::Rows::Regular::Notes

Inherits:
Column show all
Defined in:
lib/reading/parsing/rows/regular_columns/notes.rb

Overview

Constant Summary

Constants inherited from Column

Column::SHARED_REGEXES

Class Method Summary collapse

Methods inherited from Column

column_name, flatten_into_arrays, regexes_before_formats, segment_group_separator, split_by_format?, split_by_segment?, split_by_segment_group?, to_sym, tweaks

Class Method Details

.regexes(segment_index) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/reading/parsing/rows/regular_columns/notes.rb', line 12

def self.regexes(segment_index)
  [%r{\A
    (?:(?<blurb>💬)|(?<private>🔒))?
    (?<date>\d{4}/\d\d?/\d\d?)?:?\s*
    (?:
      (?:
        (?:downgraded|upgraded|updated|changed)?\s*rating
        |
        rating\s*(?:downgraded|upgraded|updated|changed)?
      )?
      (?:\s+from\s+)?
      (?:
        (?<rating_from>\d)
        \s+to\s+
        (?<rating_to>\d)
      )
      (?:\s+because\s+|\s*[[:punct:]]\s*)?
    )?
    (?<content>.+)?
  \z}xi]
end

.segment_separatorObject



8
9
10
# File 'lib/reading/parsing/rows/regular_columns/notes.rb', line 8

def self.segment_separator
  /\s*--\s*/
end