Class: JSDiff
- Inherits:
-
Object
- Object
- JSDiff
- Defined in:
- lib/jsdiff.rb,
lib/jsdiff/version.rb
Constant Summary collapse
- VERSION =
"0.9.0"
Class Method Summary collapse
Class Method Details
.parse(files, opts = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jsdiff.rb', line 9 def parse(files, opts=nil) a_path, b_path = files.take(2) a, b = [a_path, b_path].map do |path| JSON.parse(File.read(path)) end c = a.diff(b) diff_js = JSON.pretty_generate(c) return diff_js if opts.nosyntax? Pygments.highlight(diff_js, :formatter => 'terminal', :lexer => 'javascript') end |