Sha256: da09296101c0776430f92cf03eada84986ec8c20087dedd367664eb41c37f84d

Contents?: true

Size: 676 Bytes

Versions: 4

Compression:

Stored size: 676 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coderay-1.0.0.800pre lib/coderay/encoders/yaml.rb
coderay-1.0.0.798.pre lib/coderay/encoders/yaml.rb
coderay-1.0.0.788.pre lib/coderay/encoders/yaml.rb
coderay-1.0.0.778.pre lib/coderay/encoders/yaml.rb