event_stream_parser 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -10
- data/lib/event_stream_parser/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6c523a863200d11f4277cd2def00738e53d40adcae96a8bf5e0dc8e4e734457
|
4
|
+
data.tar.gz: 684c33aaf90439ce864e2b9c063f7ad487866b7749e62e5edb3f0bcbb20b777b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4527ea1befd90840ca9640b19f37f1c0232aae9ce9eab2a68612e6ff2db1d3842fdf0041bb6f6e2778950ffb86c3bd0c428d5867456e6aeb32ba01def56a154
|
7
|
+
data.tar.gz: 4b9a408e6f8eb325a52d35756af38087dcac36cf82b43ea06bd1af6f4287c45a9125d0e1d894382c2513e57e3c4239071aa7f915a7fbe1a6c9bd74dc735e0939
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# event_stream_parser
|
2
2
|
|
3
|
-
[![Gem
|
3
|
+
[![Gem (including prereleases)](https://img.shields.io/gem/v/event_stream_parser)](https://rubygems.org/gems/event_stream_parser)
|
4
4
|
[![CI](https://github.com/Shopify/event_stream_parser/actions/workflows/ci.yml/badge.svg)](https://github.com/Shopify/event_stream_parser/actions/workflows/ci.yml)
|
5
5
|
|
6
6
|
A lightweight, fully spec-compliant parser for the
|
@@ -38,23 +38,23 @@ gem install event_stream_parser
|
|
38
38
|
|
39
39
|
## Usage
|
40
40
|
|
41
|
-
Create a new Parser
|
41
|
+
Create a new Parser:
|
42
42
|
|
43
43
|
```rb
|
44
44
|
parser = EventStreamParser::Parser.new
|
45
|
-
|
46
|
-
parser.feed do |type, data, id, reconnection_time|
|
47
|
-
puts "Event type: #{type}"
|
48
|
-
puts "Event data: #{data}"
|
49
|
-
puts "Event id: #{id}"
|
50
|
-
puts "Reconnection time: #{reconnection_time}"
|
51
|
-
end
|
52
45
|
```
|
53
46
|
|
54
47
|
Then, feed it chunks as they come in:
|
55
48
|
|
56
49
|
```rb
|
57
|
-
do_something_that_yields_chunks do
|
50
|
+
do_something_that_yields_chunks do |chunk|
|
51
|
+
parser.feed(chunk) do |type, data, id, reconnection_time|
|
52
|
+
puts "Event type: #{type}"
|
53
|
+
puts "Event data: #{data}"
|
54
|
+
puts "Event id: #{id}"
|
55
|
+
puts "Reconnection time: #{reconnection_time}"
|
56
|
+
end
|
57
|
+
end
|
58
58
|
```
|
59
59
|
|
60
60
|
Or use the `stream` method to generate a proc that you can pass to a chunk
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_stream_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ates Goral
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.3.7
|
48
48
|
requirements: []
|
49
|
-
rubygems_version: 3.4.
|
49
|
+
rubygems_version: 3.4.21
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: A spec-compliant event stream parser
|