event_stream_parser 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 498814773bcffd664024e918c1f94e32393e6b8af266fe88084cadb4cd8c86d7
4
- data.tar.gz: da45b31afcb41e23bb2fb4dbde9d0c5ed173d8fb8ac0759464129528b19e49bd
3
+ metadata.gz: 49756d751627c15a8f085902ed658146505e48886f1dd00478303377cf306ef9
4
+ data.tar.gz: 02a1527fac3865d65041ae9f42c915da6f29af6db490dc18e021486571652fbf
5
5
  SHA512:
6
- metadata.gz: 2123d8df807cb4cb1a3f1981f3bd3d59eec2393579d4c41bc7a4f597be6f827e285ef8cffb37abfd12d9266e69febe5be09ad79f7dff53ef288c950ffc077603
7
- data.tar.gz: dbadc0f0bc184c0d08f8e6466f4384ce51baf25da1d97bbc90ba75a0d92f3a48468dc82882015f82d17d5f047d64625ddffe8897a51dd7b8e972a19b3d585fbb
6
+ metadata.gz: 644f4a6394f418ba3bb7ea34f0ec80cd52a1814c480fbdae7b9e15004c421c731ae273a7d68ca1976f2de471dfe898170658ccd625c5da3961712fda68c0b783
7
+ data.tar.gz: ba6cb519e0c839c65d0d4179d1ddee7ba66cd8cd7c92cac1b7c449cda497bdf71eef97912d950050ea0ec8629293556c43b173cc708e02257ce9ca50fbf1f601
data/README.md CHANGED
@@ -11,6 +11,8 @@ from an HTTP client, for example) and emits events as it parses them. But it
11
11
  remembers the last event id and reconnection time and keeps emitting them as
12
12
  long as they are not overwritten by new ones.
13
13
 
14
+ BOM stripping is left as a responsibility of the chunk provider.
15
+
14
16
  ## Installation
15
17
 
16
18
  Add this line to your application's Gemfile:
@@ -74,11 +76,7 @@ After checking out the repo:
74
76
  2. Run `rake test` to run the tests.
75
77
  3. Run `rubocop` to run Rubocop.
76
78
 
77
- To install this gem onto your local machine, run `bundle exec rake install`. To
78
- release a new version, update the version number in `version.rb`, and then run
79
- `bundle exec rake release`, which will create a git tag for the version, push
80
- git commits and tags, and push the `.gem` file to
81
- [rubygems.org](https://rubygems.org).
79
+ To install this gem onto your local machine, run `bundle exec rake install`.
82
80
 
83
81
  ## Contributing
84
82
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStreamParser
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -12,8 +12,6 @@ module EventStreamParser
12
12
  # Code comments are copied from the spec.
13
13
  #
14
14
  class Parser
15
- UTF_8_BOM = [0xEF, 0xBB, 0xBF].pack("C*").force_encoding("UTF-8").freeze
16
-
17
15
  def initialize
18
16
  ##
19
17
  # When a stream is parsed, a data buffer, an event type buffer, and a last
@@ -26,20 +24,10 @@ module EventStreamParser
26
24
 
27
25
  @reconnection_time = nil
28
26
  @buffer = +""
29
- @first_chunk = true
30
27
  @last_delimiter = nil
31
28
  end
32
29
 
33
30
  def feed(chunk, &proc)
34
- ##
35
- # The UTF-8 decode algorithm strips one leading UTF-8 Byte Order Mark (BOM),
36
- # if any.
37
- #
38
- if @first_chunk
39
- chunk = chunk.delete_prefix(UTF_8_BOM)
40
- @first_chunk = false
41
- end
42
-
43
31
  @buffer << chunk
44
32
 
45
33
  ##
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_stream_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ates Goral
@@ -54,6 +54,9 @@ homepage: https://github.com/Shopify/event_stream_parser
54
54
  licenses:
55
55
  - MIT
56
56
  metadata:
57
+ bug_tracker_uri: https://github.com/Shopify/event_stream_parser/issues
58
+ changelog_uri: https://github.com/Shopify/event_stream_parser/blob/main/CHANGELOG.md
59
+ source_code_uri: https://github.com/Shopify/event_stream_parser
57
60
  allowed_push_host: https://rubygems.org
58
61
  post_install_message:
59
62
  rdoc_options: []