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: b5580dae81209573a74a22792f5f50f329805eb67d74c67d28beb9438115a6ba
4
- data.tar.gz: 3e97957ff1b4af95a5506ff240c0e500ccf69242d4c03a5db16c84ae03917520
3
+ metadata.gz: 1c6266f727e24e5cd93cc1db656d84dc177dc0fceb0ab435a14164216d6dec80
4
+ data.tar.gz: 53e06769f132ac67ee113af6fecdb327184adc034b00aa58c0af8eab376ef45f
5
5
  SHA512:
6
- metadata.gz: 6829aded4d70daf81fa7cab074c7029ee945997434d357cc251cd993ba89ec56bb1b74b4d98964a150cad0d8f3fbb0f9781f31c5eab760b3c5ba392dffac17f1
7
- data.tar.gz: 57d35f30118d60e234595d66b65580f29b205e7f09115ce3b44c1085d6845ff02c831855e2cd7267983b9e7a87a1480080f28a4cb533a0520b944e445bccd15b
6
+ metadata.gz: fb0db8ed1e6636145f25ec8ca3cc3653ce415e7381c8e5d2126e7da7174782c57a2a4d60a3693794ae93ac02bd178b40f55971ffbf721e0d86b7c73fd17b930a
7
+ data.tar.gz: ee6222b098f64dcc809d0d54ed9c1bad84f54816e05602b601c7ae8b0211f26fb41c05e46fe9728dc362536971021cc2a6e232a5e9f8ac34eff3f6ef55e94cb3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.58.3 (2021-11-16)
4
+
5
+ * Return block value by `next`
6
+ * Add `Node#filename` method
7
+
3
8
  ## 0.58.2 (2021-10-23)
4
9
 
5
10
  * Do not break the whole `recursive_children`
@@ -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
- stop = :stop
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
- stop = :stop
106
+ next :stop
110
107
  end
111
- stop
112
108
  end
113
109
  end
114
110
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '0.58.2'
5
+ VERSION = '0.58.3'
6
6
  end
7
7
  end
@@ -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.2
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-10-22 00:00:00.000000000 Z
11
+ date: 2021-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport