Class: Cinebase::TitleSanitizer
- Inherits:
-
Struct
- Object
- Struct
- Cinebase::TitleSanitizer
- Defined in:
- lib/cinebase/title_sanitizer.rb
Overview
Sabitize titles base class
Instance Attribute Summary collapse
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
Instance Attribute Details
#title ⇒ Object
Returns the value of attribute title
3 4 5 |
# File 'lib/cinebase/title_sanitizer.rb', line 3 def title @title end |
Instance Method Details
#sanitized ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cinebase/title_sanitizer.rb', line 4 def sanitized @sanitized ||= begin sanitized = title remove.each do |pattern| sanitized.gsub! pattern, '' end replace.each do |pattern, prefix| sanitized.gsub!(pattern) { |_| prefix + $1 } end sanitized.squeeze(' ').strip end end |