Sha256: f61707f2b1d4be5943f438db183d27cd1de45395624cf32a9962f21405c89338

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

module CodeRay
module Encoders
  
  # = YAML Encoder
  #
  # Slow.
  class YAML < Encoder
    
    autoload :YAML, 'yaml'
    
    register_for :yaml
    
    FILE_EXTENSION = 'yaml'
    
  protected
    def setup options
      super
      
      @data = []
    end
    
    def finish options
      YAML.dump @data, @out
      
      super
    end
    
  public
    def text_token text, kind
      @data << [text, kind]
    end
    
    def begin_group kind
      @data << [:begin_group, kind]
    end
    
    def end_group kind
      @data << [:end_group, kind]
    end
    
    def begin_line kind
      @data << [:begin_line, kind]
    end
    
    def end_line kind
      @data << [:end_line, kind]
    end
    
  end
  
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coderay-1.0.0.815pre lib/coderay/encoders/yaml.rb