Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/std++/main.rb
Instance Method Summary collapse
-
#sanitize ⇒ Object
Copy of OpenNebula VCenterDriver::FileHelper.
Instance Method Details
#sanitize ⇒ Object
Copy of OpenNebula VCenterDriver::FileHelper
199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/std++/main.rb', line 199 def sanitize text = self.clone # Bad as defined by wikipedia: # https://en.wikipedia.org/wiki/Filename in # Reserved_characters_and_words # Also have to escape the backslash bad_chars = ['/', '\\', '?', '%', '*', ':', '|', '"', '<', '>', '.', ' '] bad_chars.each do |bad_char| text.gsub!(bad_char, '_') end text end |