rlp 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rlp/sedes/serializable.rb +18 -11
- data/lib/rlp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33270682525eb514bb89f6ced04dcfe4931b3908
|
4
|
+
data.tar.gz: df227f161b03005b783cdddd1e096f4ffe3175ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: caf057aa14a28d27c5629ed64c95f5856a7af9f6692ced2a0d3b5d8d52085dec4fdaa3b21c62375b884d571e580559973f7ef18141324b26edbd269f13b34a3a
|
7
|
+
data.tar.gz: 21008044f49d0816035967eb05cfaf68cd12289828636d81262e1bc0bf072baa29b829b3b9c4b2ef29ecb60931fddc265e05153056b6d7d2789c5d8242097ca1
|
data/README.md
CHANGED
@@ -11,13 +11,13 @@ A Ruby implementation of Ethereum's Recursive Length Prefix encoding (RLP). You
|
|
11
11
|
Put it in your Gemfile:
|
12
12
|
|
13
13
|
```
|
14
|
-
gem '
|
14
|
+
gem 'rlp'
|
15
15
|
```
|
16
16
|
|
17
17
|
or
|
18
18
|
|
19
19
|
```
|
20
|
-
gem i
|
20
|
+
gem i rlp
|
21
21
|
```
|
22
22
|
|
23
23
|
## Usage
|
@@ -18,20 +18,27 @@ module RLP
|
|
18
18
|
|
19
19
|
def set_serializable_fields(fields)
|
20
20
|
raise "Cannot override serializable fields!" if @serializable_fields
|
21
|
+
@serializable_fields = {} # always reset
|
22
|
+
fields.each {|name, sedes| add_serializable_field name, sedes }
|
23
|
+
end
|
24
|
+
|
25
|
+
def add_serializable_field(name, sedes)
|
26
|
+
unless @serializable_fields
|
27
|
+
# append or reset
|
28
|
+
@serializable_fields = superclass.include?(Sedes::Serializable) ? superclass.serializable_fields.dup : {}
|
29
|
+
end
|
21
30
|
|
22
|
-
@serializable_fields =
|
31
|
+
@serializable_fields[name] = sedes
|
23
32
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
33
|
+
class_eval <<-ATTR
|
34
|
+
def #{name}
|
35
|
+
@#{name}
|
36
|
+
end
|
29
37
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
38
|
+
def #{name}=(v)
|
39
|
+
_set_field(:#{name}, v)
|
40
|
+
end
|
41
|
+
ATTR
|
35
42
|
end
|
36
43
|
|
37
44
|
def inherit_serializable_fields!
|
data/lib/rlp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rlp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Xie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|