unparser 0.0.14 → 0.0.15

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
  SHA1:
3
- metadata.gz: 11255e57313330254373b6beda0deb4377e6e463
4
- data.tar.gz: 0f946bd5799e2e86c4f93c1014e514f75a8cf4b2
3
+ metadata.gz: fcc5300960fb746ffaeee812c9d21214d27abe4f
4
+ data.tar.gz: 44b23113a26b5621647687ede360f478a561f56d
5
5
  SHA512:
6
- metadata.gz: 6b0102c269b17bee7c295b050103b68778968ff7d5b2e51b7360e7a6d11cad94f5281375344014284fbe5c1d5459ff65323fe7a7d3a5ba91e3c683ed718929ea
7
- data.tar.gz: e164f2beffb130ce0fecd88e2b910f728d604dbc0defdbf59262b521565fccf3743b9e22e60a2a29a2482bd0ed0cbbcc9c6eec618f3feec9e611e111e7a1381a
6
+ metadata.gz: ea844db930580529a6e45a935b6fd756da832c8578251040303deffe7057bb62efdca72e700cdb03d96c623744aacc3f7fb4b540203690a17e10a92fa5805edf
7
+ data.tar.gz: d398a4881888cc974bcaef1ecd255d5ef382b71f0061c8f2816a159383aa162b9d92f927e1eef6d7a59858156631842f02c753b82131bc18c4d187f3c32127af
data/Gemfile.devtools CHANGED
@@ -14,7 +14,7 @@ group :guard do
14
14
  gem 'guard', '~> 1.8.1'
15
15
  gem 'guard-bundler', '~> 1.0.0'
16
16
  gem 'guard-rspec', '~> 3.0.2'
17
- gem 'guard-rubocop', '~> 0.2.0'
17
+ # gem 'guard-rubocop', '~> 0.2.0'
18
18
  gem 'guard-mutant', '~> 0.0.1'
19
19
 
20
20
  # file system change event handling
@@ -34,7 +34,7 @@ group :metrics do
34
34
  gem 'flay', '~> 2.3.1'
35
35
  gem 'flog', '~> 4.1.1'
36
36
  gem 'reek', '~> 1.3.1', git: 'https://github.com/troessner/reek.git'
37
- gem 'rubocop', '~> 0.10.0', git: 'https://github.com/bbatsov/rubocop.git'
37
+ # gem 'rubocop', '~> 0.10.0', git: 'https://github.com/bbatsov/rubocop.git'
38
38
  gem 'simplecov', '~> 0.7.1'
39
39
  gem 'yardstick', '~> 0.9.6'
40
40
 
@@ -320,6 +320,20 @@ module Unparser
320
320
  end
321
321
  end
322
322
 
323
+ # Return parent type
324
+ #
325
+ # @return [Symbol]
326
+ # if parent is present
327
+ #
328
+ # @return [nil]
329
+ # otherwiseo
330
+ #
331
+ # @api private
332
+ #
333
+ def parent_type
334
+ parent && parent.node && parent.node.type
335
+ end
336
+
323
337
  # Emitter that fully relies on parser source maps
324
338
  class SourceMap < self
325
339
 
@@ -131,7 +131,7 @@ module Unparser
131
131
  # @api private
132
132
  #
133
133
  def dispatch
134
- if parent.node.type == :mlhs
134
+ if parent_type == :mlhs
135
135
  parentheses { delimited(children) }
136
136
  else
137
137
  delimited(children)
@@ -42,6 +42,18 @@ describe Unparser, 'spike' do
42
42
  generated.should eql(input)
43
43
  end
44
44
 
45
+ def self.assert_generates_one_way(ast, expected, versions = RUBIES)
46
+ with_versions(versions) do |version, parser|
47
+ it "should generate #{ast.inspect} as #{expected} under #{version}" do
48
+ if ast.kind_of?(String)
49
+ ast = parser.parse(ast)
50
+ end
51
+ generated = Unparser.unparse(ast)
52
+ generated.should eql(expected)
53
+ end
54
+ end
55
+ end
56
+
45
57
  def self.assert_generates(ast, expected, versions = RUBIES)
46
58
  with_versions(versions) do |version, parser|
47
59
  it "should generate #{ast.inspect} as #{expected} under #{version}" do
@@ -226,6 +238,7 @@ describe Unparser, 'spike' do
226
238
  assert_source '$a, $b = 1, 2'
227
239
  assert_source 'a, b = foo'
228
240
  assert_source 'a, (b, c) = 1, [2, 3]'
241
+ assert_generates_one_way s(:mlhs, s(:lvasgn, :a), s(:lvasgn, :b)), 'a, b'
229
242
  end
230
243
  end
231
244
 
data/unparser.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'unparser'
5
- s.version = '0.0.14'
5
+ s.version = '0.0.15'
6
6
 
7
7
  s.authors = ['Markus Schirp']
8
8
  s.email = 'mbj@schir-dso.com'
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.extra_rdoc_files = %w(README.md)
18
18
  s.executables = [ 'test-unparser' ]
19
19
 
20
- s.add_dependency('parser', '~> 2.0.0.pre3')
20
+ s.add_dependency('parser', '~> 2.0.0.pre5')
21
21
  s.add_dependency('concord', '~> 0.1.1')
22
22
  s.add_dependency('adamantium', '~> 0.0.10')
23
23
  s.add_dependency('equalizer', '~> 0.0.5')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2013-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.pre3
19
+ version: 2.0.0.pre5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.pre3
26
+ version: 2.0.0.pre5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: concord
29
29
  requirement: !ruby/object:Gem::Requirement