momocop 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODEOWNERS +1 -0
- data/lib/momocop/enum_extractor.rb +9 -2
- data/lib/momocop/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7bbeea4b66a57e0dd2768cd593c653501cc745e73439d254dfa6ff56d26ad7a
|
4
|
+
data.tar.gz: 3181561d6c590050106bcf13a1c6b6cec2f22179e2b1c8bcbb5b126630fd27d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19113cb5c6945b125d1688553deb24933b111ebe9d43521212fad4b38ca495676635c3047250e07a8a4b784c68f4d9b51a76ae8b0f56a167f5dc60d60939a78d
|
7
|
+
data.tar.gz: c9841b2375bdd3e81682e73da8dd42f45174de77c27c265b10e7a7f7750bd8424c804bb2bea1e3f02f287d52926cd4895670988dac7d19f6d3b5d72c6a3a7314
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @supermomonga
|
@@ -21,8 +21,15 @@ module Momocop
|
|
21
21
|
|
22
22
|
private def extract_enums(node, enums = [])
|
23
23
|
if node.type == :send && node.children[1] == :enum
|
24
|
-
|
25
|
-
|
24
|
+
arg = node.children[2]
|
25
|
+
|
26
|
+
if arg.type == :sym
|
27
|
+
# enum :role, { admin: 0, user: 1 }
|
28
|
+
enums << arg.children[0]
|
29
|
+
elsif arg.type == :hash
|
30
|
+
# enum role: { admin: 0, user: 1 }
|
31
|
+
enums << arg.children[0].children[0].children[0].to_sym
|
32
|
+
end
|
26
33
|
elsif node.children.is_a? Array
|
27
34
|
node.children.each do |child|
|
28
35
|
extract_enums(child, enums) if child.is_a? Parser::AST::Node
|
data/lib/momocop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: momocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- supermomonga
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- ".rubocop.yml"
|
64
64
|
- ".rubocop_todo.yml"
|
65
65
|
- CHANGELOG.md
|
66
|
+
- CODEOWNERS
|
66
67
|
- CODE_OF_CONDUCT.md
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|