sourcify 0.6.0.rc3 → 0.6.0.rc4
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.
@@ -116,10 +116,11 @@ module Sourcify
|
|
116
116
|
|
117
117
|
def valid?(snippet, validate_as = nil)
|
118
118
|
sexp = Ripper.sexp(snippet)
|
119
|
+
return false unless sexp
|
119
120
|
|
120
121
|
case validate_as
|
121
122
|
when :hash then sexp[-1][0][0] == :hash
|
122
|
-
when nil then
|
123
|
+
when nil then true
|
123
124
|
else raise ArgumentError
|
124
125
|
end
|
125
126
|
end
|
data/lib/sourcify/version.rb
CHANGED
@@ -26,7 +26,7 @@ describe "Proc#to_source from { ... } block (w nested hash)" do
|
|
26
26
|
\)
|
27
27
|
end
|
28
28
|
|
29
|
-
should 'handle method w only hash args' do
|
29
|
+
should 'handle method w only hash args (wo parens)' do
|
30
30
|
(
|
31
31
|
lambda {
|
32
32
|
test :a => 2
|
@@ -38,7 +38,19 @@ describe "Proc#to_source from { ... } block (w nested hash)" do
|
|
38
38
|
\)
|
39
39
|
end
|
40
40
|
|
41
|
-
should 'handle method w
|
41
|
+
should 'handle method w only hash args (w parens)' do
|
42
|
+
(
|
43
|
+
lambda {
|
44
|
+
test(:a => 2)
|
45
|
+
}
|
46
|
+
).should.be having_source(%Q\
|
47
|
+
proc do
|
48
|
+
test(:a => 2)
|
49
|
+
end
|
50
|
+
\)
|
51
|
+
end
|
52
|
+
|
53
|
+
should 'handle method w mixed args (wo parens)' do
|
42
54
|
(
|
43
55
|
lambda {
|
44
56
|
test 1, :a => 2
|
@@ -50,6 +62,18 @@ describe "Proc#to_source from { ... } block (w nested hash)" do
|
|
50
62
|
\)
|
51
63
|
end
|
52
64
|
|
65
|
+
should 'handle method w mixed args (w parens)' do
|
66
|
+
(
|
67
|
+
lambda {
|
68
|
+
test(1, :a => 2)
|
69
|
+
}
|
70
|
+
).should.be having_source(%Q\
|
71
|
+
proc do
|
72
|
+
test(1, :a => 2)
|
73
|
+
end
|
74
|
+
\)
|
75
|
+
end
|
76
|
+
|
53
77
|
if RUBY_VERSION.include?('1.9.')
|
54
78
|
require File.join(File.expand_path(File.dirname(__FILE__)), '19x_extras')
|
55
79
|
behaves_like 'Proc#to_source from { ... } block (1.9.*)'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sourcify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0.
|
4
|
+
version: 0.6.0.rc4
|
5
5
|
prerelease: 6
|
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: 2013-
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby2ruby
|
@@ -312,6 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
312
312
|
- - ! '>='
|
313
313
|
- !ruby/object:Gem::Version
|
314
314
|
version: '0'
|
315
|
+
segments:
|
316
|
+
- 0
|
317
|
+
hash: -1083890604759725001
|
315
318
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
316
319
|
none: false
|
317
320
|
requirements:
|