Class: BlueConductor::HTTP::Record::Sanitizer
- Inherits:
-
Object
- Object
- BlueConductor::HTTP::Record::Sanitizer
- Defined in:
- lib/blue_conductor/http/record/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.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(producer) ⇒ Sanitizer
constructor
A new instance of Sanitizer.
- #strip(str) ⇒ Object
Constructor Details
#initialize(producer) ⇒ Sanitizer
Returns a new instance of Sanitizer.
9 10 11 12 |
# File 'lib/blue_conductor/http/record/sanitizer.rb', line 9 def initialize(producer) @band = producer.band @title = producer.title end |
Instance Attribute Details
#band ⇒ Object (readonly)
Returns the value of attribute band.
7 8 9 |
# File 'lib/blue_conductor/http/record/sanitizer.rb', line 7 def band @band end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/blue_conductor/http/record/sanitizer.rb', line 7 def title @title end |
Instance Method Details
#clean ⇒ Object
14 15 16 17 |
# File 'lib/blue_conductor/http/record/sanitizer.rb', line 14 def clean @band = strip(@band) @title = strip(@title) end |
#strip(str) ⇒ Object
19 20 21 |
# File 'lib/blue_conductor/http/record/sanitizer.rb', line 19 def strip(str) str.downcase.gsub(UNWANTED_CHARS, "-") end |