From fa975bbf5d40644d987887b4cf273a3f02612f03 Mon Sep 17 00:00:00 2001 From: murphy Date: Sat, 1 May 2010 01:31:56 +0000 Subject: Direct Streaming! See #142 and Changes.textile. --- lib/coderay/encoders/json.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/coderay/encoders/json.rb') diff --git a/lib/coderay/encoders/json.rb b/lib/coderay/encoders/json.rb index 78f0ec0..bb09809 100644 --- a/lib/coderay/encoders/json.rb +++ b/lib/coderay/encoders/json.rb @@ -33,11 +33,23 @@ module Encoders end def text_token text, kind - { :type => 'text', :text => text, :kind => kind } + @out << { :type => 'text', :text => text, :kind => kind } end - def block_token action, kind - { :type => 'block', :action => action, :kind => kind } + def begin_group kind + @out << { :type => 'block', :action => 'open', :kind => kind } + end + + def end_group kind + @out << { :type => 'block', :action => 'close', :kind => kind } + end + + def begin_line kind + @out << { :type => 'block', :action => 'begin_line', :kind => kind } + end + + def end_line kind + @out << { :type => 'block', :action => 'end_line', :kind => kind } end def finish options -- cgit v1.2.1