diff options
| author | no author <noone@nowhere> | 2005-09-26 02:58:54 +0000 | 
|---|---|---|
| committer | no author <noone@nowhere> | 2005-09-26 02:58:54 +0000 | 
| commit | 84b8431608174e74a4c0d2394eb330a6621bc74b (patch) | |
| tree | ffc2bd7ce21708a9147247c80b0e7fc7728ea063 /lib/coderay/encoders/text.rb | |
| download | coderay-84b8431608174e74a4c0d2394eb330a6621bc74b.tar.gz | |
New Repository, initial import
Diffstat (limited to 'lib/coderay/encoders/text.rb')
| -rw-r--r-- | lib/coderay/encoders/text.rb | 33 | 
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/coderay/encoders/text.rb b/lib/coderay/encoders/text.rb new file mode 100644 index 0000000..4f0a754 --- /dev/null +++ b/lib/coderay/encoders/text.rb @@ -0,0 +1,33 @@ +module CodeRay
 +	module Encoders
 +
 +		class Text < Encoder
 +
 +			include Streamable
 +			register_for :text
 +
 +			FILE_EXTENSION = 'txt'
 +
 +			DEFAULT_OPTIONS = {
 +				:separator => ''
 +			}
 +
 +			protected
 +			def setup options
 +				super
 +				@sep = options[:separator]
 +			end
 +
 +			def token text, kind
 +				return unless text.respond_to :to_str
 +				@out << text + @sep
 +			end
 +
 +			def finish options
 +				@out.chomp @sep
 +			end
 +
 +		end
 +
 +	end
 +end
  | 
