sorbet_view 0.19.0 → 0.20.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 +4 -4
- data/lib/sorbet_view/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/sorbet_view.rb +10 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 629b241dc8d1b11aa89e99921b68a88f017e084568c2f6456c1503c9fdb43a54
|
|
4
|
+
data.tar.gz: f56310e5c9a89e55bed12d91919b0dcbb08ed71d3c5e01bc62da62f790b22eda
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b322eb9643bcdba5bc0f7f1cd29d5978b96710017af9d070aa1821aeb17a5e06965f6b8c3f21eeeab04b97b4ce92be311e935e44ba0d27d0a7e6902ecedfa3cf
|
|
7
|
+
data.tar.gz: 13ac66bd93104f462c664b3fd89a75b89fb692dfec59a55b118b49a4fe0ad3d0ae7b45096b74259367165becd59669f63ba0c6b7afa657888526dd4ef7059dba
|
data/lib/sorbet_view/version.rb
CHANGED
|
@@ -136,8 +136,7 @@ module Tapioca
|
|
|
136
136
|
# Extract instance variables and their types from srb-lens for a controller action
|
|
137
137
|
sig { params(controller: T.untyped, action_name: String).returns(T::Hash[String, String]) }
|
|
138
138
|
def extract_ivars_from_srb_lens(controller, action_name)
|
|
139
|
-
|
|
140
|
-
method_info = methods&.first
|
|
139
|
+
method_info = find_method_info(controller, action_name)
|
|
141
140
|
return {} unless method_info
|
|
142
141
|
|
|
143
142
|
ivars = method_info.ivars
|
|
@@ -284,7 +283,8 @@ module Tapioca
|
|
|
284
283
|
|
|
285
284
|
layout_name = controller._layout if controller.respond_to?(:_layout)
|
|
286
285
|
if layout_name.is_a?(String) && !layout_name.empty?
|
|
287
|
-
|
|
286
|
+
layout_parts = layout_name.split('/').map { |p| camelize(p) }
|
|
287
|
+
base_class_name = "SorbetView::Generated::Layouts::#{layout_parts.join('::')}"
|
|
288
288
|
format_suffixes = find_template_format_suffixes('layouts', layout_name)
|
|
289
289
|
class_names = format_suffixes.empty? ? [base_class_name] : format_suffixes.map { |fs| "#{base_class_name}::#{fs}" }
|
|
290
290
|
|
|
@@ -418,10 +418,15 @@ module Tapioca
|
|
|
418
418
|
end
|
|
419
419
|
end
|
|
420
420
|
|
|
421
|
+
# srb-lens matches class names by suffix, so a query for "FoosController#show" also
|
|
422
|
+
# matches "Admin::FoosController#show". Prefer the method whose FQN equals the query
|
|
423
|
+
# exactly; fall back to the first match, which is still needed for actions inherited
|
|
424
|
+
# from a parent controller (their FQN is the parent's and never equals the query).
|
|
421
425
|
sig { params(controller: T.untyped, method_name: String).returns(T.untyped) }
|
|
422
426
|
def find_method_info(controller, method_name)
|
|
423
|
-
|
|
424
|
-
methods
|
|
427
|
+
query = "#{controller.name}##{method_name}"
|
|
428
|
+
methods = @project.find_methods(query)
|
|
429
|
+
methods&.find { |m| m.fqn == query } || methods&.first
|
|
425
430
|
end
|
|
426
431
|
|
|
427
432
|
sig { params(method_info: T.untyped).returns(T::Array[RBI::Param]) }
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sorbet_view
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.20.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kazuma
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-07-09 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: herb
|