diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b0d992..dbbabf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Unreleased +# 1.0.0 + +- Fix example in README and deem public contract stable + # 0.3.0 - Add support for Ruby 2.6, drop rubocop-shopify diff --git a/README.md b/README.md index bfc957b..b450c01 100644 --- a/README.md +++ b/README.md @@ -38,23 +38,23 @@ gem install event_stream_parser ## Usage -Create a new Parser and give it a block to receive events: +Create a new Parser: ```rb parser = EventStreamParser::Parser.new - -parser.feed do |type, data, id, reconnection_time| - puts "Event type: #{type}" - puts "Event data: #{data}" - puts "Event id: #{id}" - puts "Reconnection time: #{reconnection_time}" -end ``` Then, feed it chunks as they come in: ```rb -do_something_that_yields_chunks do { |chunk| parser.feed(chunk) } +do_something_that_yields_chunks do |chunk| + parser.feed(chunk) do |type, data, id, reconnection_time| + puts "Event type: #{type}" + puts "Event data: #{data}" + puts "Event id: #{id}" + puts "Reconnection time: #{reconnection_time}" + end +end ``` Or use the `stream` method to generate a proc that you can pass to a chunk diff --git a/lib/event_stream_parser/version.rb b/lib/event_stream_parser/version.rb index f71ac64..93dcc15 100644 --- a/lib/event_stream_parser/version.rb +++ b/lib/event_stream_parser/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module EventStreamParser - VERSION = '0.3.0' + VERSION = '1.0.0' end