Method: SON.strip_comments

Defined in:
lib/json/next/parser/son.rb

.strip_comments(text) ⇒ Object

pass 1



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/json/next/parser/son.rb', line 16

def self.strip_comments( text )   ## pass 1
  text.gsub( /#{DOUBLE_QUOTE}|#{SHELL_COMMENT}/ox ) do |match|
     ## puts "match: >>#{match}<< : #{match.class.name}"
     if match[0] == ?#    ## comments start with #
       ## puts "!!! removing comments"
       ''    ## remove / strip comments
     else
       match
     end
   end
end