synvert-core 0.58.2 → 0.58.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c6266f727e24e5cd93cc1db656d84dc177dc0fceb0ab435a14164216d6dec80
|
4
|
+
data.tar.gz: 53e06769f132ac67ee113af6fecdb327184adc034b00aa58c0af8eab376ef45f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb0db8ed1e6636145f25ec8ca3cc3653ce415e7381c8e5d2126e7da7174782c57a2a4d60a3693794ae93ac02bd178b40f55971ffbf721e0d86b7c73fd17b930a
|
7
|
+
data.tar.gz: ee6222b098f64dcc809d0d54ed9c1bad84f54816e05602b601c7ae8b0211f26fb41c05e46fe9728dc362536971021cc2a6e232a5e9f8ac34eff3f6ef55e94cb3
|
data/CHANGELOG.md
CHANGED
@@ -315,6 +315,13 @@ module Parser::AST
|
|
315
315
|
].join("\n")
|
316
316
|
end
|
317
317
|
|
318
|
+
# Get the file name of the current node.
|
319
|
+
#
|
320
|
+
# @return [String] file name.
|
321
|
+
def filename
|
322
|
+
loc.expression&.source_buffer.name
|
323
|
+
end
|
324
|
+
|
318
325
|
# Get the source code of current node.
|
319
326
|
#
|
320
327
|
# @return [String] source code.
|
@@ -89,12 +89,10 @@ module Synvert::Core
|
|
89
89
|
return matching_nodes
|
90
90
|
end
|
91
91
|
current_node.recursive_children do |child_node|
|
92
|
-
stop = nil
|
93
92
|
if child_node.match?(@rules)
|
94
93
|
matching_nodes << child_node
|
95
|
-
|
94
|
+
next :stop
|
96
95
|
end
|
97
|
-
stop
|
98
96
|
end
|
99
97
|
else
|
100
98
|
current_node.each do |node|
|
@@ -103,12 +101,10 @@ module Synvert::Core
|
|
103
101
|
next
|
104
102
|
end
|
105
103
|
node.recursive_children do |child_node|
|
106
|
-
stop = nil
|
107
104
|
if child_node.match?(@rules)
|
108
105
|
matching_nodes << child_node
|
109
|
-
|
106
|
+
next :stop
|
110
107
|
end
|
111
|
-
stop
|
112
108
|
end
|
113
109
|
end
|
114
110
|
end
|
data/lib/synvert/core/version.rb
CHANGED
@@ -396,6 +396,14 @@ describe Parser::AST::Node do
|
|
396
396
|
end
|
397
397
|
end
|
398
398
|
|
399
|
+
describe '#filename' do
|
400
|
+
it 'gets file name' do
|
401
|
+
source = 'foobar'
|
402
|
+
node = parse(source)
|
403
|
+
expect(node.filename).to eq '(string)'
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
399
407
|
describe '#to_source' do
|
400
408
|
it 'gets for node' do
|
401
409
|
source = 'params[:user][:email]'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.58.
|
4
|
+
version: 0.58.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|