Sha256: fc413460cb89935ce3e22afa0e032a7db34b8f340d8d74500cb93c7c4965d7b4
Contents?: true
Size: 750 Bytes
Versions: 47
Compression:
Stored size: 750 Bytes
Contents
module CodeRay module Encoders # The Tokens encoder converts the tokens to a simple # readable format. It doesn't use colors and is mainly # intended for console output. # # The tokens are converted with Tokens.write_token. # # The format is: # # <token-kind> \t <escaped token-text> \n # # Example: # # require 'coderay' # puts CodeRay.scan("puts 3 + 4", :ruby).tokens # # prints: # # ident puts # space # integer 3 # space # operator + # space # integer 4 # class Tokens < Encoder include Streamable register_for :tokens FILE_EXTENSION = 'tok' protected def token *args @out << CodeRay::Tokens.write_token(*args) end end end end
Version data entries
47 entries across 47 versions & 3 rubygems