Sha256: 40323f358378bbcd35c9afd49229c56d6e3b59efbfe9d93e6396b252ab25b61e

Contents?: true

Size: 576 Bytes

Versions: 36

Compression:

Stored size: 576 Bytes

Contents

# encoding: UTF-8
module Yajl
  module Deflate
    # A wrapper around the Zlib::Deflate class for easier JSON stream parsing
    class StreamWriter < ::Zlib::Deflate
      
      # A helper method to allow use similar to IO#write
      def write(str)
        deflate(str)
        str.size unless str.nil?
      end
      
      # A helper method for one-off encoding to a deflate-compressed stream
      #
      # Look up Yajl::Encoder#encode for parameter documentation
      def self.encode(obj, io)
        Yajl::Encoder.new.encode(obj, new(io))
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 5 rubygems

Version Path
brianmario-yajl-ruby-0.5.10 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.11 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.12 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.3 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.4 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.5 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.6 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.7 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.8 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.5.9 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.6.0 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.6.1 lib/yajl/deflate/stream_writer.rb
brianmario-yajl-ruby-0.6.3 lib/yajl/deflate/stream_writer.rb
jdg-yajl-ruby-0.5.12 lib/yajl/deflate/stream_writer.rb
oortle-yajl-ruby-0.5.8 lib/yajl/deflate/stream_writer.rb
yajl-ruby-0.7.1 lib/yajl/deflate/stream_writer.rb
yajl-ruby-0.7.0 lib/yajl/deflate/stream_writer.rb
yajl-ruby-0.6.9 lib/yajl/deflate/stream_writer.rb
yajl-ruby-0.6.8 lib/yajl/deflate/stream_writer.rb
yajl-ruby-0.6.7 lib/yajl/deflate/stream_writer.rb