flay 2.11.0 → 2.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/lib/flay.rb +15 -21
- data/test/test_flay.rb +2 -5
- metadata +2 -2
- metadata.gz.sig +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3477e1943a1382b0b51cbce9a5e4f5b60c34adc2f38e1e4b713b05f6b7476160
|
4
|
+
data.tar.gz: 042ef82c48aec49077113d53cbe425e6157fd61b36e7118af18dc7369561e77e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c05914fd7779c957f60e6e8f32d04a4069d427cf6ecb57b7be97fd53cd9d07969c0076bad6978077f09e47d73a5d7c76c5795233f846a20bc22aef2abbb41dad
|
7
|
+
data.tar.gz: bdcc376f6c7651d1fe4d7ace6349a945a221fc89152bba731719ec4083996b98d98358e6b2506fa58ca6d919dd07d99433f3c6942e0639062909f4e1d55e44e6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/lib/flay.rb
CHANGED
@@ -17,7 +17,7 @@ class File
|
|
17
17
|
end
|
18
18
|
|
19
19
|
class Flay
|
20
|
-
VERSION = "2.
|
20
|
+
VERSION = "2.12.0" # :nodoc:
|
21
21
|
|
22
22
|
class Item < Struct.new(:structural_hash, :name, :bonus, :mass, :locations)
|
23
23
|
alias identical? bonus
|
@@ -280,14 +280,26 @@ class Flay
|
|
280
280
|
end
|
281
281
|
end
|
282
282
|
|
283
|
+
##
|
284
|
+
# Before processing, filter any sexp's that match against filters
|
285
|
+
# specified in +option[:filters]+. This changes the sexp itself.
|
286
|
+
|
287
|
+
def filter_sexp exp
|
288
|
+
exp.delete_if { |sexp|
|
289
|
+
if Sexp === sexp then
|
290
|
+
del = option[:filters].any? { |pattern| pattern.satisfy? sexp }
|
291
|
+
del or (filter_sexp(sexp); false)
|
292
|
+
end
|
293
|
+
}
|
294
|
+
end
|
295
|
+
|
283
296
|
##
|
284
297
|
# Process a sexp +pt+.
|
285
298
|
|
286
299
|
def process_sexp pt
|
287
|
-
pt.deep_each do |node|
|
300
|
+
filter_sexp(pt).deep_each do |node|
|
288
301
|
next :skip if node.none? { |sub| Sexp === sub }
|
289
302
|
next :skip if node.mass < self.mass_threshold
|
290
|
-
next :skip if option[:filters].any? { |pattern| pattern.satisfy? node }
|
291
303
|
|
292
304
|
self.hashes[node.structural_hash] << node
|
293
305
|
|
@@ -330,22 +342,6 @@ class Flay
|
|
330
342
|
end
|
331
343
|
end
|
332
344
|
|
333
|
-
##
|
334
|
-
# Given an array of sexp patterns (see sexp_processor), delete any
|
335
|
-
# buckets whose members match any of the patterns.
|
336
|
-
|
337
|
-
def filter *patterns
|
338
|
-
return if patterns.empty?
|
339
|
-
|
340
|
-
self.hashes.delete_if { |_, sexps|
|
341
|
-
sexps.any? { |sexp|
|
342
|
-
patterns.any? { |pattern|
|
343
|
-
pattern =~ sexp
|
344
|
-
}
|
345
|
-
}
|
346
|
-
}
|
347
|
-
end
|
348
|
-
|
349
345
|
##
|
350
346
|
# Prunes nodes that aren't relevant to analysis or are already
|
351
347
|
# covered by another node. Also deletes nodes based on the
|
@@ -361,8 +357,6 @@ class Flay
|
|
361
357
|
else
|
362
358
|
prune_conservatively
|
363
359
|
end
|
364
|
-
|
365
|
-
self.filter(*option[:filters])
|
366
360
|
end
|
367
361
|
|
368
362
|
##
|
data/test/test_flay.rb
CHANGED
@@ -450,13 +450,12 @@ class TestSexp < Minitest::Test
|
|
450
450
|
exp_foo = s(:begin,
|
451
451
|
s(:begin,
|
452
452
|
s(:filter_me,
|
453
|
-
s(:a, s(:b)))))
|
453
|
+
s(:a, s(:b, s(:c, s(:d)))))))
|
454
454
|
|
455
455
|
exp_bar = s(:begin,
|
456
456
|
s(:begin,
|
457
457
|
s(:filter_me,
|
458
|
-
s(:a, s(:b))
|
459
|
-
s(:c))))
|
458
|
+
s(:a, s(:b, s(:c, s(:d)))))))
|
460
459
|
|
461
460
|
filter = Sexp::Matcher.parse("(filter_me ___)")
|
462
461
|
options = Flay.default_options.merge(mass: 0, filters: [filter])
|
@@ -467,8 +466,6 @@ class TestSexp < Minitest::Test
|
|
467
466
|
|
468
467
|
refute_nodes :filter_me
|
469
468
|
|
470
|
-
flay.prune
|
471
|
-
|
472
469
|
assert_empty flay.hashes
|
473
470
|
end
|
474
471
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
AhXhF6Wi2GTMezlj5jlI5XV7WsJUSwTp/YiVvcmT74ZaCRvexm6EnNhkrvJJ1Xeu
|
30
30
|
V+HB+LYYhXWitInO/eXxDrFB
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2018-04-
|
32
|
+
date: 2018-04-30 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: sexp_processor
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
�
|
2
|
+
���x�����v����#�\����]�}gh�%l�]��/���Z+����R�{'�gm�&j�x����n����G${�~�9�����a4�&�R��Rpf]�b�p�mSC�IQ��k�(-~~<\�Z�_�^(����ט`�!e����"�M�jRW�ry��{e�����wRg%�&cn$�b����
|
3
|
+
��V��l�����e��_�ӽ��B=C�ܸ��H�H�� |d�넷���߉_��d
|