Sha256: 1d3f550e938cc00dc556a88487b911d344c8b2eb7713c871e4184498c9e3b90e

Contents?: true

Size: 789 Bytes

Versions: 13

Compression:

Stored size: 789 Bytes

Contents

# encoding: UTF-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../../lib')

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

13 entries across 13 versions & 2 rubygems

Version Path
yajl-ruby-0.7.8 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.7 examples/encoding/chunked_encoding.rb
benofsky-yajl-ruby-0.7.7 examples/encoding/chunked_encoding.rb
benofsky-yajl-ruby-0.7.6 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.6 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.5 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.4 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.3 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.2 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.1 examples/encoding/chunked_encoding.rb
yajl-ruby-0.7.0 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.9 examples/encoding/chunked_encoding.rb
yajl-ruby-0.6.8 examples/encoding/chunked_encoding.rb