synvert-core 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46b762aaad4169f0bfc8b8857b06af6048532335
4
- data.tar.gz: 2f4c8f3d350d69bafe0dd7f775270261421bdd06
3
+ metadata.gz: 147d5855d29224ef920cd0249c021c0825f52ae7
4
+ data.tar.gz: 151c8fcd306d95ac3e401f6b5e7c266dde352bd5
5
5
  SHA512:
6
- metadata.gz: f6500aff52b0381a6bf29fa8f38f76163508d915b2b69e2ba07f53e3cd7f4c1d5e545d58c33ba6cf48ff183d84dd20a68c8aa729ee0286c8013ff29bc7228007
7
- data.tar.gz: cf34ebc9213041687782fe32f1b9ba0c07f85e17b1e6763b606482e12d292f339c4fa861d28943798b1cd4272a2bc720e991b6138c675327122828de7d9b8f06
6
+ metadata.gz: efd95157a71e181ad15658aa06c3ddb41d85a80801ecb118cd4d74877db98bdfaf9a6ff66d9838deca432cdcbd3cc122c572c6998120053a3711db6ac6ea02b2
7
+ data.tar.gz: 4d7105931e33abe42f7d6722e9948251151155db3ee401ecb6f187228c67226b0662f831dc45b3de0050a4bf280400781c20c1b6d3b43251889e28635030b8d1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.7.5
4
+
5
+ * Fix left_value and right_value node attribute
6
+
3
7
  ## 0.7.4
4
8
 
5
9
  * Add add_arguments_with_parenthesis_if_necessary helper method
@@ -214,13 +214,10 @@ module Parser::AST
214
214
 
215
215
  # Return the left value.
216
216
  #
217
- # @return [Array<Parser::AST::Node>] variable nodes.
217
+ # @return [Parser::AST::Node] variable nodes.
218
218
  # @raise [Synvert::Core::MethodNotSupported] if calls on other node.
219
219
  def left_value
220
- case self.type
221
- when :masgn
222
- self.children[0].children
223
- when :lvasgn, :ivasgn
220
+ if [:masgn, :lvasgn, :ivasgn].include? self.type
224
221
  self.children[0]
225
222
  else
226
223
  raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{self.debug_info}"
@@ -232,10 +229,7 @@ module Parser::AST
232
229
  # @return [Array<Parser::AST::Node>] variable nodes.
233
230
  # @raise [Synvert::Core::MethodNotSupported] if calls on other node.
234
231
  def right_value
235
- case self.type
236
- when :masgn
237
- self.children[1].children
238
- when :lvasgn, :ivasgn
232
+ if [:masgn, :lvasgn, :ivasgn].include? self.type
239
233
  self.children[1]
240
234
  else
241
235
  raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{self.debug_info}"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = "0.7.4"
5
+ VERSION = "0.7.5"
6
6
  end
7
7
  end
@@ -190,7 +190,7 @@ describe Parser::AST::Node do
190
190
  describe "#left_value" do
191
191
  it 'gets for masgn' do
192
192
  node = parse("a, b = 1, 2")
193
- expect(node.left_value.map(&:to_source)).to eq ['a', 'b']
193
+ expect(node.left_value.to_source).to eq 'a, b'
194
194
  end
195
195
 
196
196
  it 'gets for lvasgn' do
@@ -207,7 +207,12 @@ describe Parser::AST::Node do
207
207
  describe "#right_value" do
208
208
  it 'gets for masgn' do
209
209
  node = parse("a, b = 1, 2")
210
- expect(node.right_value).to eq [parse("1"), parse("2")]
210
+ expect(node.right_value).to eq parse('[1, 2]')
211
+ end
212
+
213
+ it 'gets for masgn' do
214
+ node = parse("a, b = params")
215
+ expect(node.right_value).to eq parse("params")
211
216
  end
212
217
 
213
218
  it 'gets for lvasgn' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang