Class: BlueConductor::HTTP::Song::Sanitizer
- Inherits:
-
Object
- Object
- BlueConductor::HTTP::Song::Sanitizer
- Defined in:
- lib/blue_conductor/http/song/sanitizer.rb
Constant Summary collapse
- UNWANTED_CHARS =
%r([^a-zA-Z0-9])
Instance Attribute Summary collapse
-
#band ⇒ Object
readonly
Returns the value of attribute band.
-
#song ⇒ Object
readonly
Returns the value of attribute song.
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(manager) ⇒ Sanitizer
constructor
A new instance of Sanitizer.
- #strip(str) ⇒ Object
Constructor Details
#initialize(manager) ⇒ Sanitizer
Returns a new instance of Sanitizer.
9 10 11 12 |
# File 'lib/blue_conductor/http/song/sanitizer.rb', line 9 def initialize(manager) @band = manager.band @song = manager.song end |
Instance Attribute Details
#band ⇒ Object (readonly)
Returns the value of attribute band.
7 8 9 |
# File 'lib/blue_conductor/http/song/sanitizer.rb', line 7 def band @band end |
#song ⇒ Object (readonly)
Returns the value of attribute song.
7 8 9 |
# File 'lib/blue_conductor/http/song/sanitizer.rb', line 7 def song @song end |
Instance Method Details
#clean ⇒ Object
14 15 16 17 |
# File 'lib/blue_conductor/http/song/sanitizer.rb', line 14 def clean @band = strip(@band) @song = strip(@song) end |
#strip(str) ⇒ Object
19 20 21 |
# File 'lib/blue_conductor/http/song/sanitizer.rb', line 19 def strip(str) str.downcase.gsub(UNWANTED_CHARS, "-") end |