Class: Arclight::NormalizedTitle

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(title, date = nil) ⇒ NormalizedTitle



10
11
12
13
# File 'lib/arclight/normalized_title.rb', line 10

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_sString



16
17
18
# File 'lib/arclight/normalized_title.rb', line 16

def to_s
  normalize
end