skyfall 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a508caa504715c30f9d9ff68dbf419c8b88ad00e5fbc6315ae6a3abb624e167
4
- data.tar.gz: 9010ece05b7f1cce0a2573ecfa75965d1dba2b77cd7926eaa8fc510f8e2ae7e2
3
+ metadata.gz: 6e7396b9d5f8de50025ea41e80b17578607e40aab7bfce17ffd948aa428cdd0f
4
+ data.tar.gz: 8915e1d9cc0169c9c8bf0c3995f92fd36a14a49cab846c876a766afd92e31ab1
5
5
  SHA512:
6
- metadata.gz: b9fc0370411496e76a4caaa7b2795e999b2fbf3445e21a02e3b9135e4c7fc5e3766d7ea3a94e145becf3ab96fd4d494b0f7d8a04a09eee03698a97125d44238d
7
- data.tar.gz: b302a5f7eefc30509a6b721809105bd9439f6919b31ab73878d132fa8a67062d0d77c17d375d3d433cb77bbba63127a823d1817f5d1a71f16c2b6601dca7d493
6
+ metadata.gz: 7fb7381a4fd818a6a9e956107dadb51e0a519898eb6b19f94d28cf3c41d2a25775460aace039b2b4713105e46ec5fef9bf9e5595a0170642f3d6cc59da56ca3f
7
+ data.tar.gz: db58dc53caacf3eda013732b9324bd03be5b93445500beac2b035d5e15273dd6f2f7b59f05887f3dab8518a95809126f31d7a6c79eac9c6760d268fc11cc5a19
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.2.2] - 2023-09-06
2
+
3
+ - fixed image CIDs returned in the record JSON as CBOR tag objects (they are now returned decoded to the string form)
4
+
1
5
  ## [0.2.1] - 2023-08-19
2
6
 
3
7
  - optimized `WebsocketMessage` parsing performance - lazy parsing of most properties (message decoding should be over 50% faster on average)
@@ -32,11 +32,38 @@ module Skyfall
32
32
  end
33
33
 
34
34
  def section_with_cid(cid)
35
- @sections.detect { |s| s.cid == cid }&.body
35
+ section = @sections.detect { |s| s.cid == cid }
36
+
37
+ if section
38
+ convert_cids(section.body)
39
+ section.body
40
+ end
36
41
  end
37
42
 
38
43
  private
39
44
 
45
+ def convert_cids(object)
46
+ if object.is_a?(Hash)
47
+ object.each do |k, v|
48
+ if v.is_a?(Hash) || v.is_a?(Array)
49
+ convert_cids(v)
50
+ elsif v.is_a?(CBOR::Tagged)
51
+ object[k] = CID.from_cbor_tag(v)
52
+ end
53
+ end
54
+ elsif object.is_a?(Array)
55
+ object.each_with_index do |v, i|
56
+ if v.is_a?(Hash) || v.is_a?(Array)
57
+ convert_cids(v)
58
+ elsif v.is_a?(CBOR::Tagged)
59
+ object[i] = CID.from_cbor_tag(v)
60
+ end
61
+ end
62
+ else
63
+ raise DecodeError, "Unexpected value type in record: #{object}"
64
+ end
65
+ end
66
+
40
67
  def read_header(buffer)
41
68
  len = buffer.read_varint
42
69
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skyfall
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skyfall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuba Suder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-19 00:00:00.000000000 Z
11
+ date: 2023-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base32