draw_static 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/module_finder.rb +22 -0
  3. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86a3c493b9af23fc74a9d68ccbbdc1aa681e7f017b4c8b0f05ae28ad2b8579df
4
- data.tar.gz: 04c89c9a4c2e137653a551db7c655971387683fb2cd4d971f5a6443fe42ce3dc
3
+ metadata.gz: a607c79dc62ae1af383dc5b0607a7de480ece7f67009e9ab5ed4cfc62babed11
4
+ data.tar.gz: 47961e9c573c589f4b767af5c5813409704c0b41264fb195e9f0c57066321332
5
5
  SHA512:
6
- metadata.gz: 1274ea3cab90a069dc8ca840fcef6fca7595a99da268abef30dfd3d212ffe706428381731c37a15e83df5f69625beee5a15ab245b42cad914ce54f5bf37842d4
7
- data.tar.gz: bcbf44d58d8c797f7c1c01a446981063900f286bb9732c63728ac314dbe99c77c61c701113aed70c952465075c66c80a863677a6102cc0e826d83a7b68abcc32
6
+ metadata.gz: f3a9a65d4743edcab2fb822d9cd0d862c0dfa7955f10f804939087740af3124dccb3f48e1a4c34b45cd579d8419b521025d638d1a6851602d635203016cfe4f6
7
+ data.tar.gz: aeb8462046c0371740e18ec0c64e4fd86bd10a2070a100b9a98ac4dd1fb6d187cedd49151ef8ee0eb222e839050947f81913f598cb2acd758af70195dd0d5968
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Object in charge of finding a prefix
4
+ class ModuleFinder
5
+ class << self
6
+ def dig(routes)
7
+ find_scope_of_route(routes.instance_variable_get('@scope'))
8
+ end
9
+
10
+ def find_scope_of_route(route)
11
+ found = route&.instance_variable_get('@hash')&.try(:[], :module)
12
+ return found if found
13
+
14
+ route = route.instance_variable_get('@parent')
15
+ if route
16
+ find_scope_of_route(route)
17
+ else
18
+ ''
19
+ end
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draw_static
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inou Ridder
@@ -37,6 +37,7 @@ extensions: []
37
37
  extra_rdoc_files: []
38
38
  files:
39
39
  - lib/draw_static.rb
40
+ - lib/module_finder.rb
40
41
  - lib/static_routes.rb
41
42
  homepage: https://github.com/InouRidder/draw_static
42
43
  licenses: