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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cead02f7fbe91ad4769fc782868b1e5e3164aa57
4
- data.tar.gz: 1fcd8e1cdd04cf859edb55948e97cc615a3014c2
3
+ metadata.gz: 33270682525eb514bb89f6ced04dcfe4931b3908
4
+ data.tar.gz: df227f161b03005b783cdddd1e096f4ffe3175ee
5
5
  SHA512:
6
- metadata.gz: 4438a85ad8cbde73ff8dc84db0e2b62efcb5b4abd446ccbd2ef2b8a436ded2fcd2857d7449eb8b18f701bc9b2af473ebb856494f54c46cf70874822b7e71b377
7
- data.tar.gz: 7c991c6c754fef3a6ddc1a3c148c5ba6e55decb65f7401dd1f2b98345dba33088843ec57f1d10fb45f592faafa0fae172821f62a6db5e28faabfba2a365a20e5
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 'ruby-rlp', require: 'rlp'
14
+ gem 'rlp'
15
15
  ```
16
16
 
17
17
  or
18
18
 
19
19
  ```
20
- gem i ruby-rlp
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 = fields
31
+ @serializable_fields[name] = sedes
23
32
 
24
- fields.keys.each do |field|
25
- class_eval <<-ATTR
26
- def #{field}
27
- @#{field}
28
- end
33
+ class_eval <<-ATTR
34
+ def #{name}
35
+ @#{name}
36
+ end
29
37
 
30
- def #{field}=(v)
31
- _set_field(:#{field}, v)
32
- end
33
- ATTR
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!
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : ascii-8bit -*-
2
2
 
3
3
  module RLP
4
- VERSION = '0.7.2'
4
+ VERSION = '0.7.3'
5
5
  end
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.2
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-05-08 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake