to_source 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.md +4 -0
- data/README.md +3 -3
- data/TODO +0 -1
- data/lib/to_source/visitor.rb +6 -1
- data/spec/unit/to_source/visitor/class_methods/run_spec.rb +11 -2
- data/to_source.gemspec +1 -1
- metadata +3 -3
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
to_source
|
2
2
|
=========
|
3
3
|
|
4
|
-
[![Build Status](https://secure.travis-ci.org/
|
5
|
-
[![Dependency Status](https://gemnasium.com/
|
6
|
-
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/
|
4
|
+
[![Build Status](https://secure.travis-ci.org/mbj/to_source.png?branch=master)](http://travis-ci.org/mbj/to_source)
|
5
|
+
[![Dependency Status](https://gemnasium.com/mbj/to_source.png)](https://gemnasium.com/mbj/to_source)
|
6
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/mbj/to_source)
|
7
7
|
|
8
8
|
Reverse parser to generate source code from the Rubinius AST. Also works well under MRI.
|
9
9
|
|
data/TODO
CHANGED
data/lib/to_source/visitor.rb
CHANGED
@@ -901,7 +901,12 @@ module ToSource
|
|
901
901
|
#
|
902
902
|
def super(node)
|
903
903
|
z_super(node)
|
904
|
+
# Stupid hack to ensure super() is emitted, this lib needs a redesign!
|
905
|
+
arguments = node.arguments
|
906
|
+
empty = arguments.array.empty? && !arguments.splat && !node.block.kind_of?(Rubinius::AST::BlockPass19)
|
907
|
+
emit('(') if empty
|
904
908
|
arguments(node)
|
909
|
+
emit(')') if empty
|
905
910
|
end
|
906
911
|
|
907
912
|
# Emit concat args
|
@@ -1175,7 +1180,7 @@ module ToSource
|
|
1175
1180
|
#
|
1176
1181
|
def element_reference(node)
|
1177
1182
|
dispatch(node.receiver)
|
1178
|
-
arguments(node,'[',']')
|
1183
|
+
arguments(node, '[', ']')
|
1179
1184
|
end
|
1180
1185
|
|
1181
1186
|
# Emit send with arguments
|
@@ -484,6 +484,10 @@ describe ToSource::Visitor,'.run' do
|
|
484
484
|
assert_source 'super'
|
485
485
|
end
|
486
486
|
|
487
|
+
context 'with explicit zero arguments' do
|
488
|
+
assert_source 'super()'
|
489
|
+
end
|
490
|
+
|
487
491
|
context 'with argument' do
|
488
492
|
assert_source 'super(a)'
|
489
493
|
end
|
@@ -1040,8 +1044,13 @@ describe ToSource::Visitor,'.run' do
|
|
1040
1044
|
|
1041
1045
|
context 'with spat and block arguments' do
|
1042
1046
|
assert_source <<-RUBY
|
1043
|
-
def
|
1044
|
-
|
1047
|
+
def initialize(attributes, options)
|
1048
|
+
@attributes = freeze_object(attributes)
|
1049
|
+
@options = freeze_object(options)
|
1050
|
+
@attribute_for = Hash[@attributes.map do |attribute|
|
1051
|
+
attribute.name
|
1052
|
+
end.zip(@attributes)]
|
1053
|
+
@keys = coerce_keys
|
1045
1054
|
end
|
1046
1055
|
RUBY
|
1047
1056
|
end
|
data/to_source.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'to_source'
|
4
|
-
s.version = '0.2.
|
4
|
+
s.version = '0.2.6'
|
5
5
|
s.authors = ['Josep M. Bach', 'Markus Schirp']
|
6
6
|
s.email = ['josep.m.bach@gmail.com', 'mbj@seonic.net']
|
7
7
|
s.homepage = 'http://github.com/txus/to_source'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: adamantium
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
97
|
+
rubygems_version: 1.8.23
|
98
98
|
signing_key:
|
99
99
|
specification_version: 3
|
100
100
|
summary: Transform your Rubinius AST nodes back to source code. Reverse parsing!
|