Class: Arclight::NormalizedTitle
- Inherits:
-
Object
- Object
- Arclight::NormalizedTitle
- Defined in:
- lib/arclight/normalized_title.rb
Overview
A utility class to normalize titles, typically by joining the title and date, e.g., “My Title, 1990-2000”
Instance Method Summary collapse
-
#initialize(title, date = nil) ⇒ NormalizedTitle
constructor
A new instance of NormalizedTitle.
-
#to_s ⇒ String
The normalized title/date.
Constructor Details
#initialize(title, date = nil) ⇒ NormalizedTitle
Returns a new instance of NormalizedTitle.
12 13 14 15 |
# File 'lib/arclight/normalized_title.rb', line 12 def initialize(title, date = nil) @title = title.gsub(/\s*,\s*$/, '').strip if title.present? @date = date.strip if date.present? end |
Instance Method Details
#to_s ⇒ String
Returns the normalized title/date.
18 19 20 |
# File 'lib/arclight/normalized_title.rb', line 18 def to_s normalize end |