Class: Reading::Row::TitleAttribute
- Defined in:
- lib/reading/attribute/all_attributes.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
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/reading/attribute/all_attributes.rb', line 37 def parse if item_head.end_with?(config.deep_fetch(:csv, :short_separator).rstrip) raise InvalidHeadError, "Missing title? Head column ends in a separator" end item_head .remove(/\A#{config.deep_fetch(:csv, :regex, :formats)}/) .remove(/.+#{config.deep_fetch(:csv, :short_separator)}/) .remove(/#{config.deep_fetch(:csv, :long_separator)}.+\z/) .strip .presence || (raise InvalidHeadError, "Missing title") end |