Class: Paperclip::FilenameCleaner
- Inherits:
-
Object
- Object
- Paperclip::FilenameCleaner
- Defined in:
- lib/paperclip/filename_cleaner.rb
Instance Method Summary collapse
- #call(filename) ⇒ Object
-
#initialize(invalid_character_regex) ⇒ FilenameCleaner
constructor
A new instance of FilenameCleaner.
Constructor Details
#initialize(invalid_character_regex) ⇒ FilenameCleaner
Returns a new instance of FilenameCleaner.
3 4 5 |
# File 'lib/paperclip/filename_cleaner.rb', line 3 def initialize(invalid_character_regex) @invalid_character_regex = invalid_character_regex end |
Instance Method Details
#call(filename) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/paperclip/filename_cleaner.rb', line 7 def call(filename) if @invalid_character_regex filename.gsub(@invalid_character_regex, "_") else filename end end |