Method: JSONCop::Generator#generate!
- Defined in:
- lib/jsoncop/generator.rb
#generate! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/jsoncop/generator.rb', line 15 def generate! jsoncop_generate_start = /\/\/ MARK: \- JSONCop\-Start/ jsoncop_generate_end = /\/\/ JSONCop\-End/ content = File.read file_path if content.match(jsoncop_generate_start) && content.match(jsoncop_generate_end) content.gsub!(/\/\/ MARK: \- JSONCop\-Start[^$]*JSONCop\-End/, json_cop_template) else content += json_cop_template end File.write file_path, content end |