hub_kernel 0.27.0 → 0.29.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: 0b75dd33da96e8bc1bd5161a74fc004c527892842f1cd118827353874fb7e0a4
4
+ data.tar.gz: 9f17abdb22deb70e29c7bc80642e4a264340220cbdbbec299ef2b4ba51fa3c1b
5
5
  SHA512:
6
- metadata.gz: bf9219c9a2027f881df22d5aca5149f34408fb6c91156f550ab9fbd992c572d4bc3bfb31f944722fbb73154c37646ef3a3386e9049f3d5aefaf82a5962727f3c
7
- data.tar.gz: 70344238486a35ed0bff5707898f24f3ee807647cb03f95e0b9426fd640a1506a968fb13dc561d18ab13e1262d203c887c0ae83e2aad7db070e8be095412943e
6
+ metadata.gz: eff51e2b76a8a5dd6c4c98e083c5b6090bea2318feb468d7c2e25ee8d625aec56eb55dba088e1f3f622f73f11a413e841661a2d2de09a6a6713a8e0b235b4371
7
+ data.tar.gz: fd005c78271dba55057cca73001445d614ba461c7ae0b1cc1b0fc26e60d26d7a1aab5b9e0a1ddef1bf14eba701f5264e7af7b993b7b2fdc2235889cde018aaf7
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 or an `.erb` view, 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,7 @@ 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
+ without_string_text(source).scan(/[A-Z]\w*(?:::[A-Z]\w*)*/).filter_map { |name| owned_class_in(name) }.uniq.select { |name| crossing?(name, hub) }
20
23
  end
21
24
 
22
25
  def read_folders(paths)
@@ -88,5 +91,7 @@ module HubKernel
88
91
  end
89
92
 
90
93
  def owner_of_view_folder(folder) = owner_of("#{folder}Controller") || owner_of(folder) || @host_layer
94
+
95
+ def without_string_text(source) = source.gsub(DOUBLE_QUOTED) { |literal| literal.scan(INTERPOLATED).join(" ") }
91
96
  end
92
97
  end
@@ -1,3 +1,3 @@
1
1
  module HubKernel
2
- VERSION = "0.27.0"
2
+ VERSION = "0.29.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.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider