Class: Reading::Parsing::Rows::Regular::Head

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

Overview

Constant Summary

Constants inherited from Column

Column::SHARED_REGEXES

Class Method Summary collapse

Methods inherited from Column

column_name, segment_group_separator, split_by_segment?, split_by_segment_group?, to_sym, tweaks

Class Method Details

.flatten_into_arraysObject



24
25
26
# File 'lib/reading/parsing/rows/regular_columns/head.rb', line 24

def self.flatten_into_arrays
  %i[extra_info series_names series_volumes]
end

.regexes(segment_index) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/reading/parsing/rows/regular_columns/head.rb', line 28

def self.regexes(segment_index)
  [
    # author and title
    (%r{\A
      (
        (?<author>.+?)
        \s+-\s+
      )?
      (?<title>.+)
    \z}x if segment_index.zero?),
    *Column::SHARED_REGEXES[:series_and_extra_info],
  ].compact
end

.regexes_before_formatsObject



13
14
15
16
17
18
# File 'lib/reading/parsing/rows/regular_columns/head.rb', line 13

def self.regexes_before_formats
  [
    /\A#{Column::SHARED_REGEXES[:progress]}\z/,
    /.+/,
  ]
end

.segment_separatorObject



20
21
22
# File 'lib/reading/parsing/rows/regular_columns/head.rb', line 20

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

.split_by_format?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/reading/parsing/rows/regular_columns/head.rb', line 9

def self.split_by_format?
  true
end