Class: TrelloFs::StringToFileName

Inherits:
Object
  • Object
show all
Defined in:
lib/trello-fs/string_to_file_name.rb

Class Method Summary collapse

Class Method Details

.convert(str) ⇒ Object



3
4
5
6
7
# File 'lib/trello-fs/string_to_file_name.rb', line 3

def self.convert(str)
  str.gsub(/[^\w\s_-]+/, '').
    gsub(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2').
    gsub(/\s+/, '_')
end