Class: Rabbit::Filename
- Inherits:
-
Object
- Object
- Rabbit::Filename
- Defined in:
- lib/rabbit/filename.rb
Class Method Summary collapse
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(filename) ⇒ Filename
constructor
A new instance of Filename.
Constructor Details
#initialize(filename) ⇒ Filename
Returns a new instance of Filename.
27 28 29 |
# File 'lib/rabbit/filename.rb', line 27 def initialize(filename) @utf8_filename = filename.encode("UTF-8") end |
Class Method Details
.sanitize(string) ⇒ Object
22 23 24 |
# File 'lib/rabbit/filename.rb', line 22 def sanitize(string) string.gsub(/[\r\n]/, "").gsub(/[\/\\:]/, "-") end |
Instance Method Details
#encode ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rabbit/filename.rb', line 31 def encode if GLib.const_defined?(:Win32) GLib::Win32.locale_filename_from_utf8(@utf8_filename) else GLib.filename_from_utf8(@utf8_filename) end end |