Class: Datanorm::Helpers::Filename
- Inherits:
-
Object
- Object
- Datanorm::Helpers::Filename
- Includes:
- Calls
- Defined in:
- lib/datanorm/helpers/filename.rb
Overview
Converts a String to something suitable for a filename.
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/datanorm/helpers/filename.rb', line 11 def call raise "Should not write to file called `#{input.inspect}`" if input.nil? # In case there are special characters in a product number. utf8_encoded = ::Datanorm::Helpers::Utf8.call(input) "#{Base64.urlsafe_encode64(utf8_encoded.to_s)}.txt" end |