synvert-core 0.53.0 → 0.54.0

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: a56859d257b024e86f223d076c77d4effd93d6ffef44de99091d49a62a12841e
4
- data.tar.gz: f0b8658b8701417180ae578eb2ba5c7607e634327ced470e2ad0017980a2e0d8
3
+ metadata.gz: 1c7ee99e848625ed3bad729d3e08186370d5fb58d4412fb1d09d89bf15559a22
4
+ data.tar.gz: 30f16d4aa02a2a6f6677a5657b24296127869e17c5237a4b63f2d6d1ed658203
5
5
  SHA512:
6
- metadata.gz: 320beadaca69f8e9613f1cd15c5c6fd71bf7bd51881af453ade6e99f56e9516b782264b0d63d4398bbd4fe61af8cb3c7df78d517d0e29762f76de2c2d2091255
7
- data.tar.gz: 22a208b06b416f70e191e7215e21016d603a06ff91a0c7ad8795333906179f46b325e0507ffafd65b7fcebc639e99a6aaba5428632ac6f19b87a2b41dedf9e47
6
+ metadata.gz: 936f304f6b829be86eb1da55aa110a7b3ed7c249cb9da4a1bc5246a1d687fb8dd7548fe68a2632c4df874c921f829e05ec5cab838373b587db5a3e59b900a0ab
7
+ data.tar.gz: 15f39e1386ee166762dd3afca86b8d246e3cc8ea0cbdcb5efd15eb9141f911ffcaabaf15a6062f9a6fe31dc720e7242fe4a81633bc12ffa06c18efe431d4d410
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.54.0 (2021-08-28)
4
+
5
+ * Change `goto_scope` param from array to string
6
+
3
7
  ## 0.53.0 (2021-08-22)
4
8
 
5
9
  * Fix nested child in Node#child_node_range
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # synvert-core-ruby
2
2
 
3
- <img src="https://xinminlabs.github.io/synvert/img/logo_96.png" alt="logo" width="32" height="32" />
3
+ <img src="https://synvert.xinminlabs.com/img/logo_96.png" alt="logo" width="32" height="32" />
4
4
 
5
5
  ![Main workflow](https://github.com/xinminlabs/synvert-core-ruby/actions/workflows/main.yml/badge.svg)
6
6
  [![Gem Version](https://badge.fury.io/rb/synvert-core.png)](http://badge.fury.io/rb/synvert-core)
@@ -36,5 +36,5 @@ Or install it yourself as:
36
36
  4. Push to the branch (`git push origin my-new-feature`)
37
37
  5. Create a new Pull Request
38
38
 
39
- [1]: https://xinminlabs.github.io/synvert/
39
+ [1]: https://synvert.xinminlabs.com
40
40
  [2]: https://rubydoc.info/github/xinminlabs/synvert-core-ruby/master/frames
@@ -1,21 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert::Core
4
- # RemoveAction to delete code.
4
+ # DeleteAction to delete code.
5
5
  class Rewriter::DeleteAction < Rewriter::Action
6
6
  def initialize(instance, *selectors)
7
7
  super(instance, nil)
8
8
  @selectors = selectors
9
9
  end
10
10
 
11
- # Begin position of code to replace.
11
+ # Begin position of code to delete.
12
12
  #
13
13
  # @return [Integer] begin position.
14
14
  def begin_pos
15
15
  @selectors.map { |selector| @node.child_node_range(selector) }.compact.map(&:begin_pos).min
16
16
  end
17
17
 
18
- # End position of code to replace.
18
+ # End position of code to delete.
19
19
  #
20
20
  # @return [Integer] end position.
21
21
  def end_pos
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert::Core
4
- # AddAction to add code to the node.
4
+ # InsertAction to add code to the node.
5
5
  class Rewriter::InsertAction < Rewriter::Action
6
6
  def initialize(instance, code, at:)
7
7
  super(instance, code)
@@ -139,7 +139,7 @@ module Synvert::Core
139
139
 
140
140
  # Set current_node properly, process and set current_node back to original current_node.
141
141
  #
142
- # @param node [Parser::AST::Node] node set to current_node
142
+ # @param node [Parser::AST::Node] node set to other_node
143
143
  # @yield process
144
144
  def process_with_other_node(node)
145
145
  original_node = current_node
@@ -177,10 +177,10 @@ module Synvert::Core
177
177
  # Parse goto_node dsl, it creates a [Synvert::Core::Rewriter::GotoScope] to go to a child node,
178
178
  # then continue operating on the child node.
179
179
  #
180
- # @param *child_node_names [Array] the name of the child nodes.
180
+ # @param child_node_name [Symbol|String] the name of the child nodes.
181
181
  # @param block [Block] block code to continue operating on the matching nodes.
182
- def goto_node(*child_node_names, &block)
183
- Rewriter::GotoScope.new(self, *child_node_names, &block).process
182
+ def goto_node(child_node_name, &block)
183
+ Rewriter::GotoScope.new(self, child_node_name, &block).process
184
184
  end
185
185
 
186
186
  # Parse if_exist_node dsl, it creates a [Synvert::Core::Rewriter::IfExistCondition] to check
@@ -6,11 +6,11 @@ module Synvert::Core
6
6
  # Initialize a scope
7
7
  #
8
8
  # @param instance [Synvert::Core::Rewriter::Instance]
9
- # @param *child_node_names [Array]
9
+ # @param child_node_name [Symbol|string]
10
10
  # @param block [Block]
11
- def initialize(instance, *child_node_names, &block)
11
+ def initialize(instance, child_node_name, &block)
12
12
  @instance = instance
13
- @child_node_names = child_node_names
13
+ @child_node_name = child_node_name
14
14
  @block = block
15
15
  end
16
16
 
@@ -20,7 +20,7 @@ module Synvert::Core
20
20
  return unless current_node
21
21
 
22
22
  child_node = current_node
23
- @child_node_names.each do |child_node_name|
23
+ @child_node_name.to_s.split('.').each do |child_node_name|
24
24
  child_node = child_node_name.is_a?(Parser::AST::Node) ? child_node_name : child_node.send(child_node_name)
25
25
  end
26
26
  @instance.process_with_other_node child_node do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '0.53.0'
5
+ VERSION = '0.54.0'
6
6
  end
7
7
  end
@@ -24,7 +24,7 @@ module Synvert::Core
24
24
  run = false
25
25
  type_in_scope = nil
26
26
  scope =
27
- Rewriter::GotoScope.new instance, :caller, :receiver do
27
+ Rewriter::GotoScope.new instance, 'caller.receiver' do
28
28
  run = true
29
29
  type_in_scope = node.type
30
30
  end
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.53.0
4
+ version: 0.54.0
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-08-22 00:00:00.000000000 Z
11
+ date: 2021-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport