Class: Reading::Row::ExperiencesAttribute
- Defined in:
- lib/reading/attribute/experiences/experiences_attribute.rb
Instance Method Summary collapse
Methods inherited from Attribute
Constructor Details
This class inherits a constructor from Reading::Row::Attribute
Instance Method Details
#parse ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/reading/attribute/experiences/experiences_attribute.rb', line 12 def parse started, finished = dates_split(columns) experiences_with_dates = started.map.with_index { |entry, i| variant_index = variant_index(entry) spans_attr = SpansSubattribute.new(date_entry: entry, dates_finished: finished, date_index: i, variant_index:, columns:, config:) { spans: spans_attr.parse || template.fetch(:spans), group: group(entry) || template.fetch(:group), variant_index: variant_index || template.fetch(:variant_index) } }.presence if experiences_with_dates # Raises an error if any sequence of dates does not make sense. DatesValidator.validate(experiences_with_dates, config) return experiences_with_dates else if prog = ProgressSubattribute.new(columns:, config:).parse_head return [template.deep_merge(spans: [{ progress: prog }] )] else return nil end end end |