sorcerer 0.3.3 → 0.3.4
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.
- data/lib/sorcerer/resource.rb +7 -1
- data/lib/sorcerer/version.rb +1 -1
- data/test/sorcerer/resource_test.rb +30 -0
- metadata +2 -2
data/lib/sorcerer/resource.rb
CHANGED
@@ -466,7 +466,13 @@ module Sorcerer
|
|
466
466
|
emit(" ")
|
467
467
|
resource(sexp[2])
|
468
468
|
},
|
469
|
-
:command_call =>
|
469
|
+
:command_call => lambda { |sexp|
|
470
|
+
resource(sexp[1])
|
471
|
+
emit(sexp[2])
|
472
|
+
resource(sexp[3])
|
473
|
+
emit(" ")
|
474
|
+
resource(sexp[4])
|
475
|
+
},
|
470
476
|
:const_path_field => lambda { |sexp|
|
471
477
|
resource(sexp[1])
|
472
478
|
emit("::")
|
data/lib/sorcerer/version.rb
CHANGED
@@ -163,6 +163,36 @@ class SourcerTest < Test::Unit::TestCase
|
|
163
163
|
assert_resource "obj.meth(a, *args, &code)"
|
164
164
|
end
|
165
165
|
|
166
|
+
def test_can_source_method_call_without_parens
|
167
|
+
assert_resource "obj.meth a"
|
168
|
+
assert_resource "obj.meth a, b"
|
169
|
+
assert_resource "obj.meth a, b, c"
|
170
|
+
assert_resource "obj.meth *args"
|
171
|
+
assert_resource "obj.meth a, *args"
|
172
|
+
assert_resource "obj.meth &code"
|
173
|
+
assert_resource "obj.meth a, &code"
|
174
|
+
assert_resource "obj.meth a, *args, &code"
|
175
|
+
assert_resource "obj.meth a, *args do |x| x.y end"
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_can_source_method_called_with_scope_op_without_parans
|
179
|
+
assert_resource "Const::meth"
|
180
|
+
assert_resource "Const::meth a"
|
181
|
+
assert_resource "Const::meth a, b"
|
182
|
+
assert_resource "Const::meth a, *b"
|
183
|
+
assert_resource "Const::meth a, *b, &block"
|
184
|
+
end
|
185
|
+
|
186
|
+
def xtest_can_source_method_called_with_scope_op_with_parens
|
187
|
+
# I don't think we get enough info to accurately resource these.
|
188
|
+
# All these calls come back with a period rather than a double
|
189
|
+
# colon.
|
190
|
+
assert_resource "Const::meth(a)"
|
191
|
+
assert_resource "Const::meth(a, b)"
|
192
|
+
assert_resource "Const::meth(a, *b)"
|
193
|
+
assert_resource "Const::meth(a, *b, &block)"
|
194
|
+
end
|
195
|
+
|
166
196
|
def test_can_source_method_without_explicit_target
|
167
197
|
assert_resource "meth(a)"
|
168
198
|
assert_resource "meth(a, b)"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorcerer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Generate the original Ruby source from a Ripper-style abstract syntax
|
15
15
|
tree.
|