Class: Reading::Parsing::Rows::Regular::Length

Inherits:
Column show all
Defined in:
lib/reading/parsing/rows/regular_columns/length.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, segment_separator, split_by_format?, split_by_segment?, split_by_segment_group?, to_sym, tweaks

Class Method Details

.regexes(segment_index) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/reading/parsing/rows/regular_columns/length.rb', line 7

def self.regexes(segment_index)
  [%r{\A
    # length
    (
      (
        (?<length_pages>\d+)p?
        |
        (?<length_time>\d+:\d\d)
      )
      (\s+|\z)
    )
    # each and repetitions are used in conjunction with the History column
    # each
    (
      (?<each>each)
      (\s+|\z)
    )?
    # repetitions
    (
      x
      (?<repetitions>\d+)
    )?
  \z}x]
end