diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:57:03 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 16:57:03 +0100 |
commit | ff47c7a8cb46bb901f569aafb6f43ecc953571c1 (patch) | |
tree | 085a6f34630c8dd1f0293ac7f7b38b7029a6884f /test/samples/encoder.rb | |
parent | 31c252ae9fd4b7e2f1ea2fd0009e7808d7691bcc (diff) | |
parent | 0a1f500d524ff0fb5eeafef051ccbb641954a87a (diff) | |
download | coderay-ff47c7a8cb46bb901f569aafb6f43ecc953571c1.tar.gz |
Merge branch 'master' into tweak-function-colors
Diffstat (limited to 'test/samples/encoder.rb')
-rw-r--r-- | test/samples/encoder.rb | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/test/samples/encoder.rb b/test/samples/encoder.rb deleted file mode 100644 index bfcfbfa..0000000 --- a/test/samples/encoder.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'coderay'
-
-SAMPLE = "puts 17 + 4\n"
-puts 'Encoders Demo: ' + SAMPLE
-scanner = CodeRay::Scanners[:ruby].new SAMPLE
-encoder = CodeRay::Encoders[:statistic].new
-
-tokens = scanner.tokenize
-stats = encoder.encode_tokens tokens
-
-puts
-puts 'Statistic:'
-puts stats
-
-# alternative 1
-tokens = CodeRay.scan SAMPLE, :ruby
-encoder = CodeRay.encoder(:json)
-textual = encoder.encode_tokens tokens
-puts
-puts 'Original text:'
-puts textual
-
-# alternative 2
-yaml = CodeRay.encoder(:yaml).encode SAMPLE, :ruby
-puts
-puts 'YAML:'
-puts yaml
-
-# alternative 3
-require 'zlib'
-BIGSAMPLE = SAMPLE * 100
-dump = Zlib::Deflate.deflate(CodeRay.scan(BIGSAMPLE, :ruby).debug)
-puts
-puts 'Dump:'
-p dump
-puts 'compressed: %d byte < %d byte' % [dump.size, BIGSAMPLE.size]
-
-puts
-puts 'Undump:'
-puts CodeRay.scan(Zlib::Inflate.inflate(dump), :debug).statistic
|