hub_kernel 0.27.0 → 0.28.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5519634e5f01317012e931057dc2caa508996a18ee0f952ee6e4de867f285ff
4
- data.tar.gz: 5477988282902fb115811f3f08f6a7eebe8547eee1f7a5ec9c56a3b8f758272c
3
+ metadata.gz: 3502ce7bf5c817ad2af27af2dedf3089f9f5fba2238e1d833058eee55b652fda
4
+ data.tar.gz: 465b5294ef3a4493dad58e8e7763fe2cfc64332830267d9c3382fc971c3ba747
5
5
  SHA512:
6
- metadata.gz: bf9219c9a2027f881df22d5aca5149f34408fb6c91156f550ab9fbd992c572d4bc3bfb31f944722fbb73154c37646ef3a3386e9049f3d5aefaf82a5962727f3c
7
- data.tar.gz: 70344238486a35ed0bff5707898f24f3ee807647cb03f95e0b9426fd640a1506a968fb13dc561d18ab13e1262d203c887c0ae83e2aad7db070e8be095412943e
6
+ metadata.gz: d131c019e052d61f4648ae09274dcf4aae9709622f67f75718681438a839c7fe238fc90a77386e7d0f0376ceaa823687a7b751a145c580e3ebcbe5d57f1b6516
7
+ data.tar.gz: ba18eeab7e2c11aeccbdd17736245c2e925d7699d2a56d685c26507dc8261a6f52123a2e6c92634aba41a6a17f9a4564a51793b206307aa7052295f7e85e915b
data/README.md CHANGED
@@ -371,6 +371,8 @@ end
371
371
  - By default the test reads every `.rb` and `.erb` file under `app/` and under each hub
372
372
  folder's `app/`, helpers and services included.
373
373
  - A constant inside another hub's class counts as naming that class.
374
+ - In a `.rb` file, the text of a double-quoted string names no class, so a label such as
375
+ `"Billing"` is not a crossing. Code interpolated into the string is still read.
374
376
  - A name no hub owns, such as a namespace, is not a crossing, and neither is a class on
375
377
  the `shared` list.
376
378
  - `namespaces` gives a hub every class under a namespace, such as a hub gem's `Billing`,
@@ -3,6 +3,9 @@ require "active_support/core_ext/string/inflections"
3
3
 
4
4
  module HubKernel
5
5
  class Crossings
6
+ DOUBLE_QUOTED = /"(?:[^"\\]|\\.)*"/
7
+ INTERPOLATED = /#\{[^}]*\}/
8
+
6
9
  def initialize(owners: {}, shared: [], host_layer: nil, interfaces: {}, namespaces: {}, folder_files: [])
7
10
  @owners = owners
8
11
  @folder_classes = {}
@@ -16,7 +19,8 @@ module HubKernel
16
19
 
17
20
  def in(path, source)
18
21
  hub = owner_of_file(path)
19
- source.scan(/[A-Z]\w*(?:::[A-Z]\w*)*/).filter_map { |name| owned_class_in(name) }.uniq.select { |name| crossing?(name, hub) }
22
+ code = path.end_with?(".rb") ? without_string_text(source) : source
23
+ code.scan(/[A-Z]\w*(?:::[A-Z]\w*)*/).filter_map { |name| owned_class_in(name) }.uniq.select { |name| crossing?(name, hub) }
20
24
  end
21
25
 
22
26
  def read_folders(paths)
@@ -88,5 +92,7 @@ module HubKernel
88
92
  end
89
93
 
90
94
  def owner_of_view_folder(folder) = owner_of("#{folder}Controller") || owner_of(folder) || @host_layer
95
+
96
+ def without_string_text(source) = source.gsub(DOUBLE_QUOTED) { |literal| literal.scan(INTERPOLATED).join(" ") }
91
97
  end
92
98
  end
@@ -1,3 +1,3 @@
1
1
  module HubKernel
2
- VERSION = "0.27.0"
2
+ VERSION = "0.28.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub_kernel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.0
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider