Module: Ckeditor::Utils
- Defined in:
- lib/ckeditor/utils.rb
Class Method Summary collapse
-
.destroy ⇒ Object
remove the existing install (if any).
- .escape_single_quotes(str) ⇒ Object
- .parameterize_filename(filename) ⇒ Object
Class Method Details
.destroy ⇒ Object
remove the existing install (if any)
7 8 9 10 11 12 |
# File 'lib/ckeditor/utils.rb', line 7 def self.destroy directory = Rails.root.join('public', 'javascripts', 'ckeditor') if File.exist?(directory) FileUtils.rm_r(directory, :force => true) end end |
.escape_single_quotes(str) ⇒ Object
14 15 16 |
# File 'lib/ckeditor/utils.rb', line 14 def self.escape_single_quotes(str) str.gsub('\\','\0\0').gsub('</','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" } end |
.parameterize_filename(filename) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ckeditor/utils.rb', line 18 def self.parameterize_filename(filename) extension = File.extname(filename) basename = filename.gsub(/#{extension}$/, "") [basename.parameterize('_'), extension].join.downcase end |