Sha256: 492e3de8e676a5a83b7b19c074136a29d3d392d9a8f888f18e9f8fcae1e55c69

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

require 'yajl'

module Hover
  module Decoder
    class JSONStream

      def initialize(s3_object, block = ->(object) {})
        @parser = Yajl::Parser.new
        @s3_object = s3_object

        @parser.on_parse_complete = block
      end

      def start
        bucket_name = @s3_object.bucket.name
        key = @s3_object.key

        @s3_object.client.get_object(bucket: bucket_name, key: key) do |chunk|
          @parser << chunk
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hover-ruby-client-0.4.0 lib/hover/decoder/json_stream.rb
hover-ruby-client-0.3.1 lib/hover/decoder/json_stream.rb