sexp_processor 4.1.3 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +11 -0
- data/lib/sexp.rb +10 -9
- data/lib/sexp_processor.rb +1 -1
- data/test/test_sexp.rb +20 -0
- metadata +10 -10
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 4.1.4 / 2013-01-22
|
2
|
+
|
3
|
+
* 1 minor enhancement:
|
4
|
+
|
5
|
+
* Gave Sexp#structure a ~10% boost
|
6
|
+
|
7
|
+
* 2 bug fixes:
|
8
|
+
|
9
|
+
* Fixed Sexp#mass lying when using auto_shifted sexps.
|
10
|
+
* Stupid fix for ruby 2.0 method_missing 'bug'.
|
11
|
+
|
1
12
|
=== 4.1.3 / 2012-12-06
|
2
13
|
|
3
14
|
* 2 bug fixes:
|
data/lib/sexp.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
$TESTING ||= false # unless defined $TESTING
|
3
2
|
|
4
3
|
##
|
@@ -210,6 +209,11 @@ class Sexp < Array # ZenTest FULL
|
|
210
209
|
find_node meth, delete
|
211
210
|
end
|
212
211
|
|
212
|
+
def respond_to? msg, private = false # :nodoc:
|
213
|
+
# why do I need this? Because ruby 2.0 is broken. That's why.
|
214
|
+
super
|
215
|
+
end
|
216
|
+
|
213
217
|
def pretty_print(q) # :nodoc:
|
214
218
|
nnd = ')'
|
215
219
|
nnd << ".line(#{line})" if line && ENV['VERBOSE']
|
@@ -247,17 +251,15 @@ class Sexp < Array # ZenTest FULL
|
|
247
251
|
# s(:a, :b, s(:c, :d), :e) => s(:a, s(:c))
|
248
252
|
|
249
253
|
def structure
|
250
|
-
result = self.class.new
|
251
254
|
if Array === self.first then
|
252
|
-
|
253
|
-
result = self.first.structure
|
255
|
+
s(:bogus, *self).structure # TODO: remove >= 4.2.0
|
254
256
|
else
|
255
|
-
result
|
256
|
-
self.
|
257
|
-
result << subexp.structure
|
257
|
+
result = s(self.first)
|
258
|
+
self.each do |subexp|
|
259
|
+
result << subexp.structure if Sexp === subexp
|
258
260
|
end
|
261
|
+
result
|
259
262
|
end
|
260
|
-
result
|
261
263
|
end
|
262
264
|
|
263
265
|
##
|
@@ -327,4 +329,3 @@ end
|
|
327
329
|
def s(*args)
|
328
330
|
Sexp.new(*args)
|
329
331
|
end
|
330
|
-
|
data/lib/sexp_processor.rb
CHANGED
data/test/test_sexp.rb
CHANGED
@@ -203,6 +203,17 @@ class TestSexp < SexpTestCase # ZenTest FULL
|
|
203
203
|
assert_equal 7, s.mass
|
204
204
|
end
|
205
205
|
|
206
|
+
def test_mass_auto_shift
|
207
|
+
assert_equal 1, s(:a).mass
|
208
|
+
assert_equal 3, s(s(:b), s(:c)).mass
|
209
|
+
|
210
|
+
s = s(s(:call, nil, :a, s(:arglist, s(:lit, 1))),
|
211
|
+
s(:lasgn, :c),
|
212
|
+
s(:call, nil, :d, s(:arglist)))
|
213
|
+
|
214
|
+
assert_equal 7, s.mass
|
215
|
+
end
|
216
|
+
|
206
217
|
def test_method_missing
|
207
218
|
assert_nil @sexp.not_there
|
208
219
|
assert_equal s(:lit, 42), @basic_sexp.lit
|
@@ -252,9 +263,18 @@ class TestSexp < SexpTestCase # ZenTest FULL
|
|
252
263
|
end
|
253
264
|
end
|
254
265
|
|
266
|
+
def test_deep_clone
|
267
|
+
@sexp = s(:a, 1, 2, s(:b, 3, 4), 5, 6)
|
268
|
+
backup = @sexp.deep_clone
|
269
|
+
refute_same @sexp, backup, "deep clone is broken again?"
|
270
|
+
assert_equal @sexp, backup, "deep clone is broken again?"
|
271
|
+
end
|
272
|
+
|
255
273
|
def test_structure
|
256
274
|
@sexp = s(:a, 1, 2, s(:b, 3, 4), 5, 6)
|
257
275
|
backup = @sexp.deep_clone
|
276
|
+
refute_same @sexp, backup, "deep clone is broken again?"
|
277
|
+
assert_equal @sexp, backup, "deep clone is broken again?"
|
258
278
|
expected = s(:a, s(:b))
|
259
279
|
|
260
280
|
assert_equal(expected, @sexp.structure)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sexp_processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 4
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 4.1.
|
9
|
+
- 4
|
10
|
+
version: 4.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date:
|
39
|
+
date: 2013-01-23 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
@@ -46,11 +46,11 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
49
|
+
hash: 19
|
50
50
|
segments:
|
51
51
|
- 4
|
52
|
-
-
|
53
|
-
version: "4.
|
52
|
+
- 4
|
53
|
+
version: "4.4"
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id001
|
56
56
|
- !ruby/object:Gem::Dependency
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 13
|
80
80
|
segments:
|
81
81
|
- 3
|
82
|
-
-
|
83
|
-
version: "3.
|
82
|
+
- 5
|
83
|
+
version: "3.5"
|
84
84
|
type: :development
|
85
85
|
version_requirements: *id003
|
86
86
|
description: |-
|
metadata.gz.sig
CHANGED
Binary file
|