mudguard 0.2.3 → 0.2.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: 44d7f2ff1e9b179d3d64e1263ab13cb217497fce8dd174f5b0ee5ef4cdf1c67f
4
- data.tar.gz: 6597fed3f89fa210951650bec390b8c6a5196db0806b3e5b2daaba9406693d21
3
+ metadata.gz: 456ae028fad5fdfd5e2e96158d53956c7a709823d2477c351050fb220e8ab1ec
4
+ data.tar.gz: 0c9375de37dd75a71f89203c2248aad4cf4b555ef5f63d8ecb4442d63fe1a56f
5
5
  SHA512:
6
- metadata.gz: 0eecb391426607e7650a7da55c2f470acf06b44da2327c7853c1215dc2a46fcdb592cedf3a7f383d57772b16017eb5f2b0c9edb0b87c4dc1d9d3821749a7a1a1
7
- data.tar.gz: d69e2ec7b320c04a6e01475f7973992204f08653d84316865f903363b72e51928c15f98601c1b0e2a9009f712612556e0fc33811bf271c707d6cbcc92def2eba
6
+ metadata.gz: 15a30108d5b47a12905075ed35c62ace335fd4b9303b4da46301af6db2f6b5d509d4cba95e245a4144368accf710f85e4be334c9d09a50840bad4600962078d3
7
+ data.tar.gz: 6102ca6a925655ccae7d345ed4522ac8cf546f3d3fd212bedd519c1a69be3321c80a09e46b8aa1893ff67f62d9ce9703672d255dfc5ff0a22c14278dd4b7853d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mudguard (0.2.3)
4
+ mudguard (0.2.4)
5
5
  parser (~> 2.7)
6
6
  rake (~> 13.0)
7
7
 
@@ -8,11 +8,11 @@ module Mudguard
8
8
  class Consts
9
9
  def initialize(sources:)
10
10
  @consts = sources.flat_map(&:find_consts)
11
- .each_with_object(create_hash_of_hash) do |c, a|
11
+ .each_with_object({}) do |c, a|
12
12
  path = split_hierarchy(c)
13
13
  const_name = path.last
14
14
  module_names = path.take(path.count - 1)
15
- sub_module = module_names.reduce(a) { |h, m| h[m] }
15
+ sub_module = module_names.reduce(a) { |h, m| h.key?(m) ? h[m] : h[m] = {} }
16
16
  sub_module[const_name] = {} unless sub_module.key?(const_name)
17
17
  end
18
18
  end
@@ -36,12 +36,8 @@ module Mudguard
36
36
 
37
37
  SEPARATOR = "::"
38
38
 
39
- def create_hash_of_hash
40
- Hash.new { |h, k| h[k] = create_hash_of_hash }
41
- end
42
-
43
39
  def find_const_deeper(current_module, remaining_modules, consts, const_path)
44
- return if consts.nil? || consts.empty?
40
+ return if consts.nil?
45
41
 
46
42
  if remaining_modules.any?
47
43
  # Move deeper toward target module
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mudguard
4
- VERSION = "0.2.3"
4
+ VERSION = "0.2.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mudguard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorg Jenni