dgtized (owner)

Revisions

gist: 202585 Download_button fork
public
Public Clone URL: git://gist.github.com/202585.git
Embed All Files: show embed
Text only #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
$ cat exp/deflate.rb
require 'zlib'
 
data = "\000" * 10
zipped = Zlib::Deflate.deflate data
 
p zipped
 
$ ruby exp/deflate.rb
"x\234c`\200\001\000\000\n\000\001"
 
$ rbx exp/deflate.rb
An exception occurred running exp/deflate.rb
    No method 'end' on an instance of NilClass. (NoMethodError)
 
Backtrace:
  Kernel(NilClass)#end (method_missing) at kernel/delta/kernel.rb:47
                 Zlib::Deflate.deflate at lib/zlib.rb:601
                       main.__script__ at exp/deflate.rb:4
    Rubinius::CompiledMethod#as_script at kernel/common/compiled_method.rb:219
           Compiler::Utils.single_load at kernel/compiler/compile.rb:244
   Compiler::Utils.load_from_extension at kernel/compiler/compile.rb:329
               Rubinius::Loader#script at kernel/loader.rb:326
                 Rubinius::Loader#main at kernel/loader.rb:404
                     Object#__script__ at kernel/loader.rb:452
 
$ cat exp/deflate2.rb
require 'zlib'
 
d = Zlib::Deflate.new
d.set_dictionary 'aaaaaaaaaa'
d << 'abcdefghij'
 
p d.finish
 
$ ruby exp/deflate2.rb
"x\273\024\341\003\313KLJNIMK\317\310\314\002\000\025\206\003\370"
$ rbx exp/deflate2.rb
An exception occurred running exp/deflate2.rb
    unknown zlib error -6: incompatible version (Zlib::Error)
 
Backtrace:
                    Zlib.handle_error at lib/zlib.rb:1471
             Zlib::Deflate#initialize at lib/zlib.rb:627
                      main.__script__ at exp/deflate2.rb:3
   Rubinius::CompiledMethod#as_script at kernel/common/compiled_method.rb:219
          Compiler::Utils.single_load at kernel/compiler/compile.rb:244
  Compiler::Utils.load_from_extension at kernel/compiler/compile.rb:329
              Rubinius::Loader#script at kernel/loader.rb:326
                Rubinius::Loader#main at kernel/loader.rb:404
                    Object#__script__ at kernel/loader.rb:452