Sha256: 98e72d87b4c8ebe8aa4a6fb049f8426ff733e297dc02dcf2c26b3eacdb1d132a

Contents?: true

Size: 733 Bytes

Versions: 23

Compression:

Stored size: 733 Bytes

Contents

# encoding: UTF-8

require 'rubygems'
require 'yajl'

obj = {
  :a_test => "of encoding in one pass" * 512,
  :a_test2 => "of encoding in one pass" * 512,
  :a_test3 => "of encoding in one pass" * 512,
  :a_test4 => "of encoding in one pass" * 512,
  :which_will => "simply return a string when finished" * 512,
  :which_will2 => "simply return a string when finished" * 512,
  :which_will3 => "simply return a string when finished" * 512,
  :which_will4 => "simply return a string when finished" * 512,
  :as_easy_as => 123
}

chunks = 0
total_size = 0

Yajl::Encoder.encode(obj) do |chunk|
  chunks += 1
  total_size += chunk.size
  STDOUT << chunk
end

puts "\n\nEncoder generated #{total_size} bytes of data, in #{chunks} chunks"

Version data entries

23 entries across 23 versions & 4 rubygems

Version Path
brianmario-yajl-ruby-0.5.10 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.5.11 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.5.12 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.5.8 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.5.9 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.6.0 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.6.1 examples/encoding/chunked_encoding.rb
brianmario-yajl-ruby-0.6.3 examples/encoding/chunked_encoding.rb
jdg-yajl-ruby-0.5.12 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.7 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.6 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.5 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.4 examples/encoding/chunked_encoding.rb
filipegiusti-yajl-ruby-0.6.4 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.3 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.2 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.0 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.1 examples/encoding/chunked_encoding.rb
yajl-ruby-0.5.8 examples/encoding/chunked_encoding.rb
yajl-ruby-0.5.9 examples/encoding/chunked_encoding.rb