eip_validator 0.6.0 → 0.7.0
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 +4 -4
- data/lib/eip_validator.rb +5 -4
- data/lib/eip_validator/validator.rb +16 -0
- data/lib/eip_validator/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: 99b0ebd57647d998cf7bfae72ce8e59b0f0b5f78
|
4
|
+
data.tar.gz: c69ae34ba4030b678c9118b805db883ac8889a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 761be5c47dde0690f6e4cc2985d5fd0041662d35a1b9655b54cd2bf687db406200d2987132d10b5706f5805db0cca4d1ca7817c05e571b7b4825ed57c8280d26
|
7
|
+
data.tar.gz: 6f2cbc5d6b76e4479b13636e8d29a1a3f2f1cd5838697998f1d6cec45531f9e3fd2cb734da1b6322b39db4483757e00cec9db77ed1f509ac1881a9018c85bced
|
data/lib/eip_validator.rb
CHANGED
@@ -16,10 +16,11 @@ module EipValidator
|
|
16
16
|
categories = []
|
17
17
|
layers = []
|
18
18
|
file_names.map do |file_name|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# Disable file check
|
20
|
+
# unless file_name.match(/.*eip-\d+.md$/)
|
21
|
+
# puts "Warning: #{file_name} does not match eip file format"
|
22
|
+
# next
|
23
|
+
# end
|
23
24
|
attributes = Loader.load(file_name)
|
24
25
|
total+=1
|
25
26
|
begin
|
@@ -2,9 +2,24 @@ require 'active_model'
|
|
2
2
|
|
3
3
|
module EipValidator
|
4
4
|
class Validator
|
5
|
+
def initialize(opts = {})
|
6
|
+
# ruby does not allow method with -
|
7
|
+
# replaces - with _
|
8
|
+
opts.keys.each do |key|
|
9
|
+
raise("#{key} incude _ which is not allowed") if key.to_s.match(/_/)
|
10
|
+
if key.to_s.match(/-/)
|
11
|
+
new_key = opts.keys.last.to_s.gsub('-','_')
|
12
|
+
opts[new_key] = opts.delete key
|
13
|
+
end
|
14
|
+
end
|
15
|
+
super(opts)
|
16
|
+
end
|
17
|
+
|
5
18
|
include ActiveModel::Model
|
6
19
|
attr_accessor :eip, :title, :author, :type, :category, :status, :created
|
7
20
|
attr_accessor :replaces, :requires, :layer
|
21
|
+
# replace - with _
|
22
|
+
attr_accessor :discussions_to
|
8
23
|
validates_presence_of :eip, :title, :author, :type, :status, :created
|
9
24
|
validates_inclusion_of :category,
|
10
25
|
in: %w(Core Networking Interface ERC),
|
@@ -13,3 +28,4 @@ module EipValidator
|
|
13
28
|
validates_inclusion_of :status, in: %w(Draft Active Accepted Final Deferred)
|
14
29
|
end
|
15
30
|
end
|
31
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eip_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|