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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/synvert/core/node_ext.rb +7 -0
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/node_ext_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91e00ecd8d7f5d6ff82a17580d088cc323d0e94b53a1488e6be50cbeb4a44b13
|
4
|
+
data.tar.gz: 9e3f9dbb81cb07a27fdb8d0f2888d1c7827270d9b5bf9434ff0f649245de65a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c777f93827fa6485a6636571500f8def9cd0c8b7d910f61da7c309a84124e70415d8d86e97037ec4ee574ae783936267e446e6e1b870523fdb0ea4abea09f03
|
7
|
+
data.tar.gz: 4fa8ef96adce5932eed3d927d0f878684c1bff3896829c9297df8cb20eda98f4324aed12a066e8c5b2b60996f87929cd31d911b2961414dc2e8c0356edfb3f35
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/synvert/core/version.rb
CHANGED
@@ -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.
|
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
|
+
date: 2021-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|