Class: JSquish
- Inherits:
-
Object
- Object
- JSquish
- Defined in:
- lib/JSquish.rb
Class Method Summary collapse
Class Method Details
.parse(str) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/JSquish.rb', line 2 def self.parse(str) # Strip one line comments s_comment_reg = /[\/]{2}.*/ str = str.gsub(s_comment_reg,' ') # String multiline comments str = str.gsub(/\/\*[\s\S]*?\*\//m,' ') #Remove all extra space remove_regexes = [/\s+/] remove_regexes.each do |reg| str = str.gsub(reg,' ') end # Return the string str end |