prism_ext 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/prism_ext/version.rb +1 -1
- data/lib/prism_ext.rb +11 -2
- 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: 22c5cafc0d1b394671c5c138db316fc00280db3410c4da297cfb9ba434ba0de9
|
4
|
+
data.tar.gz: cf541f704ccebad9493680f2179fc605f198d208a91b4ffdc31b55e8e5ebc0e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491695add007e46db00ab987e46591a717580082953e05c52a3189168416f854451ddaa50d82ff3da9a9932b9632ed20a032fe480a08053d96c4b4b1de4d383d
|
7
|
+
data.tar.gz: b30c6172df61bf4118ae44537c5c341959b42ed8008681c048e7a86af81afe43b011c9d73a130f177ff82f81941c1c2b1ba78e6de5021d56ad0af8d196f593cf
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/prism_ext/version.rb
CHANGED
data/lib/prism_ext.rb
CHANGED
@@ -85,12 +85,21 @@ module Prism
|
|
85
85
|
|
86
86
|
def to_source
|
87
87
|
# node.slice doesn't work for InterpolatedStringNode
|
88
|
-
if
|
89
|
-
range =
|
88
|
+
if interpolated_string?
|
89
|
+
range = opening_loc.start_offset...closing_loc.end_offset
|
90
|
+
elsif type == :call_node && arguments && arguments.arguments.any?(&:interpolated_string?)
|
91
|
+
last_interpolated_string_argument = arguments.arguments.select(&:interpolated_string?).last
|
92
|
+
range = location.start_offset...last_interpolated_string_argument.closing_loc.end_offset
|
90
93
|
else
|
91
94
|
range = location.start_offset...location.end_offset
|
92
95
|
end
|
93
96
|
location.send(:source).source[range]
|
94
97
|
end
|
98
|
+
|
99
|
+
def interpolated_string?
|
100
|
+
respond_to?(:opening_loc) && respond_to?(:closing_loc) &&
|
101
|
+
opening_loc && closing_loc &&
|
102
|
+
(opening == "<<~#{closing.strip}" || opening == "<<-#{closing.strip}")
|
103
|
+
end
|
95
104
|
end
|
96
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prism_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prism
|