scale_rb 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scale_rb/metadata/metadata.rb +1 -2
- data/lib/scale_rb/metadata/registry.rb +8 -2
- data/lib/scale_rb/types.rb +3 -2
- data/lib/scale_rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a96df563f9cf0f827e034820d94316a898c4b3cab693524ee092b116c28146
|
4
|
+
data.tar.gz: 55201185ee42018db38f922fced2a30230f43f551274bbfd495dc386ac6b440d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 281c57184f73484c691b0be6076b0fb101428a0d980b3733550d0be25584cef103ff60650a671878ce03480724190308176a5c75b2c0f4faf906c3a7dae1e15b
|
7
|
+
data.tar.gz: 3be191954b301954da10e579ac326ab3cfe9c98d21d7205580ed1816b5ee1946bf08d8e4f13d4a9db17229aea6bfcac6265d80e11b23d613a33c744aa1890be4
|
@@ -18,8 +18,7 @@ module ScaleRb
|
|
18
18
|
bytes = ScaleRb::Utils.hex_to_u8a(hex)
|
19
19
|
|
20
20
|
registry = ScaleRb::Metadata::Registry.new TYPES
|
21
|
-
|
22
|
-
metadata, = ScaleRb::Codec.decode(ti, bytes, registry)
|
21
|
+
metadata, = ScaleRb::Codec.decode('MetadataPrefixed', bytes, registry)
|
23
22
|
metadata
|
24
23
|
end
|
25
24
|
|
@@ -37,8 +37,14 @@ module ScaleRb
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def [](
|
41
|
-
|
40
|
+
def [](identifier)
|
41
|
+
if identifier.is_a?(::Integer)
|
42
|
+
@types[identifier]
|
43
|
+
elsif identifier.is_a?(::String)
|
44
|
+
@types[use(identifier)]
|
45
|
+
else
|
46
|
+
raise "Unknown identifier type: #{identifier.class}"
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def inspect
|
data/lib/scale_rb/types.rb
CHANGED
@@ -10,8 +10,9 @@ module ScaleRb
|
|
10
10
|
Primitive = Types::Strict::Symbol.enum(
|
11
11
|
:I8, :U8, :I16, :U16, :I32, :U32, :I64, :U64, :I128, :U128, :I256, :U256, :Bool, :Str, :Char
|
12
12
|
)
|
13
|
-
Ti = Types::Strict::Integer
|
14
|
-
U8 = Types::Strict::Integer.constrained(gteq: 0, lt: 256)
|
13
|
+
Ti = Types::Strict::Integer | Types::Strict::String
|
14
|
+
# U8 = Types::Strict::Integer.constrained(gteq: 0, lt: 256)
|
15
|
+
U8 = Types::Strict::Integer
|
15
16
|
U8Array = Types::Strict::Array.of(U8)
|
16
17
|
Hex = Types::Strict::String.constrained(format: /\A0x[0-9a-fA-F]+\z/)
|
17
18
|
|
data/lib/scale_rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scale_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aki Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base58
|