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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ea97e8bc7f079869e9b944ea0bdbb59e65c6497b9b5dfb998e44e8d7478a0d8
4
- data.tar.gz: d14abf4167d3b7d5f46112b4c160162cd1400a4b17a61701ce11ee26881027da
3
+ metadata.gz: 22c5cafc0d1b394671c5c138db316fc00280db3410c4da297cfb9ba434ba0de9
4
+ data.tar.gz: cf541f704ccebad9493680f2179fc605f198d208a91b4ffdc31b55e8e5ebc0e1
5
5
  SHA512:
6
- metadata.gz: 15f0306ead06063a55d009705526a04004549bd666d3a256ee730f9df9ce1153d07ec3c79c4e85b9d5e09eaf61fe9af47ebf51eddc59080e2c002c64a7f7ec77
7
- data.tar.gz: f8973ba8d9f24ed64b1d3ea95e85fb1b18555f20675670a8410668c29627adb3aedab427114622d45636c53d285a5f6a63b6843c54b6fca59496b74ca3487dc1
6
+ metadata.gz: 491695add007e46db00ab987e46591a717580082953e05c52a3189168416f854451ddaa50d82ff3da9a9932b9632ed20a032fe480a08053d96c4b4b1de4d383d
7
+ data.tar.gz: b30c6172df61bf4118ae44537c5c341959b42ed8008681c048e7a86af81afe43b011c9d73a130f177ff82f81941c1c2b1ba78e6de5021d56ad0af8d196f593cf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.3.5 (2024-07-03)
4
+
5
+ * Fix call node with heredoc argument `to_source`
6
+
3
7
  ## 0.3.4 (2024-07-02)
4
8
 
5
9
  * Fix call node `to_source`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prism_ext (0.3.4)
4
+ prism_ext (0.3.5)
5
5
  prism
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrismExt
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.5"
5
5
  end
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 respond_to?(:opening_loc) && respond_to?(:closing_loc) && opening_loc && closing_loc
89
- range = [location.start_offset, opening_loc.start_offset].min...[closing_loc.end_offset, location.end_offset].max
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
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-02 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prism