synvert-core 0.59.0 → 0.60.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: '093f0af943a24314d55691d222fb181ab0526c4e1e8c557a38824609773a17a4'
4
- data.tar.gz: 96b272edcb8ed63b346bfc30c76210aee11e7cab618045b0fed27107edbe5bfd
3
+ metadata.gz: 91e00ecd8d7f5d6ff82a17580d088cc323d0e94b53a1488e6be50cbeb4a44b13
4
+ data.tar.gz: 9e3f9dbb81cb07a27fdb8d0f2888d1c7827270d9b5bf9434ff0f649245de65a5
5
5
  SHA512:
6
- metadata.gz: 6cd336f74ddcbd5342811670824cf0f821c693a3b331f82dfb1f756f7deed41ae2f6d32cbba208a138f96a240476182c674adb2a5ab4940acda70e7737024f09
7
- data.tar.gz: 6e9f09306f30fbde3dc552df33d09e2bc1e0651dcda418640cbcdc648704e427e670b4d910ffdd7039f48262c7d4cd62197e18dd111f512d1591c31643746580
6
+ metadata.gz: 6c777f93827fa6485a6636571500f8def9cd0c8b7d910f61da7c309a84124e70415d8d86e97037ec4ee574ae783936267e446e6e1b870523fdb0ea4abea09f03
7
+ data.tar.gz: 4fa8ef96adce5932eed3d927d0f878684c1bff3896829c9297df8cb20eda98f4324aed12a066e8c5b2b60996f87929cd31d911b2961414dc2e8c0356edfb3f35
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.60.0 (2021-12-02)
4
+
5
+ * Add `to_string` to `sym` node
6
+
3
7
  ## 0.59.0 (2021-11-17)
4
8
 
5
9
  * Use option `stop_when_match` instead of `recursive`
@@ -552,6 +552,13 @@ module Parser::AST
552
552
  ":#{to_value}"
553
553
  end
554
554
 
555
+ # convert symbol to string
556
+ def to_string
557
+ return to_source unless type == :sym
558
+
559
+ "#{to_value}"
560
+ end
561
+
555
562
  # convert lambda {} to -> {}
556
563
  def to_lambda_literal
557
564
  if type == :block && caller.type == :send && caller.receiver.nil? && caller.message == :lambda
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '0.59.0'
5
+ VERSION = '0.60.0'
6
6
  end
7
7
  end
@@ -827,6 +827,22 @@ describe Parser::AST::Node do
827
827
  end
828
828
  end
829
829
 
830
+ describe '#to_string' do
831
+ context 'sym node' do
832
+ it 'converts symbol to string' do
833
+ node = parse(':foobar')
834
+ expect(node.to_string).to eq 'foobar'
835
+ end
836
+ end
837
+
838
+ context 'other node' do
839
+ it 'does nothing' do
840
+ node = parse("'foobar'")
841
+ expect(node.to_string).to eq "'foobar'"
842
+ end
843
+ end
844
+ end
845
+
830
846
  describe '#to_lambda_literal' do
831
847
  context 'lambda node' do
832
848
  it 'converts to lambda literal without arguments' do
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.59.0
4
+ version: 0.60.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-11-17 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport