to_source 0.2.8 → 0.2.9

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.
@@ -1,3 +1,9 @@
1
+ # v0.2.9 2013-01-4
2
+
3
+ * [fixed] Handle regexp literals containing slashes in non shash delimiters %r(/) correctly
4
+
5
+ [Compare v0.2.8..v0.2.9](https://github.com/mbj/to_source/compare/v0.2.8...v0.2.9)
6
+
1
7
  # v0.2.8 2013-01-3
2
8
 
3
9
  * [Changed] Emit many times more ugly code, but correctnes > beautifulnes
@@ -1032,9 +1032,7 @@ module ToSource
1032
1032
  # @api private
1033
1033
  #
1034
1034
  def regex_literal(node)
1035
- emit '/'
1036
- emit node.source
1037
- emit '/'
1035
+ emit(Regexp.new(node.source).inspect)
1038
1036
  end
1039
1037
 
1040
1038
 
@@ -320,6 +320,10 @@ describe ToSource::Visitor,'.run' do
320
320
  context 'with escapes' do
321
321
  assert_source '/\//'
322
322
  end
323
+
324
+ context 'with non slash literal containing slashes' do
325
+ assert_converts '/\//', '%r(/)'
326
+ end
323
327
  end
324
328
 
325
329
  context 'dynamic string' do
@@ -390,10 +394,15 @@ describe ToSource::Visitor,'.run' do
390
394
  end
391
395
 
392
396
  context 'to self' do
397
+
393
398
  context 'explicitly' do
394
399
  assert_source 'self.foo'
395
400
  end
396
401
 
402
+ context 'explicitly with message name equals a keyword' do
403
+ assert_source 'self.and'
404
+ end
405
+
397
406
  context 'implicitly' do
398
407
  assert_source 'foo'
399
408
  end
@@ -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.8'
4
+ s.version = '0.2.9'
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.8
4
+ version: 0.2.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: