Example:
CodeRay.scan('puts "Hello world!"', :ruby).json
yields
[ {"type"=>"text", "text"=>"puts", "kind"=>"ident"}, {"type"=>"text", "text"=>" ", "kind"=>"space"}, {"type"=>"block", "action"=>"open", "kind"=>"string"}, {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"}, {"type"=>"text", "text"=>"Hello world!", "kind"=>"content"}, {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"}, {"type"=>"block", "action"=>"close", "kind"=>"string"}, ]
# File lib/coderay/encoders/json.rb, line 64 64: def begin_group kind 65: append :type => 'block', :action => 'open', :kind => kind 66: end
# File lib/coderay/encoders/json.rb, line 72 72: def begin_line kind 73: append :type => 'block', :action => 'begin_line', :kind => kind 74: end
# File lib/coderay/encoders/json.rb, line 68 68: def end_group kind 69: append :type => 'block', :action => 'close', :kind => kind 70: end
# File lib/coderay/encoders/json.rb, line 49 49: def append data 50: if @first 51: @first = false 52: else 53: @out << ',' 54: end 55: 56: @out << data.to_json 57: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.