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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d823774129843455f368f3dc22991236d0526448998c352736a92db7b4ffe91
4
- data.tar.gz: c9c43808e8ff31c78c4efdc42bf3ef1a6553467568df304be5cfc800561a985b
3
+ metadata.gz: d7bbeea4b66a57e0dd2768cd593c653501cc745e73439d254dfa6ff56d26ad7a
4
+ data.tar.gz: 3181561d6c590050106bcf13a1c6b6cec2f22179e2b1c8bcbb5b126630fd27d5
5
5
  SHA512:
6
- metadata.gz: dcb5eb8dd8d815f98dcc3acdd726f3256e17689f52a039da8f51e4e77c3a5ebfdc65ee72127a808a9bec11278ce6c7ddaad5fb1ef0df98ce31a60ddf95645a5a
7
- data.tar.gz: 7d43fd5166f63ccabeb485d89d0dffe635563001d4353f6b5ee820e3690ff7a0d70ab1d906d380cb78c17b00a43d4fb3a513bfde34ebee3b57ae761f22560b4b
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
- enum_name = node.children[2].type == :sym ? node.children[2].children[0] : node.children[2]
25
- enums << enum_name.to_sym
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Momocop
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
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.3
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