ruby_list_comprehension 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 209cae3b97fefb10d73c95e41a2b96aa4ca74f585ce0297dbc56caf68880b0b7
4
- data.tar.gz: 1dbd4792663ba7ec560989dd2505923aea9cbc8af302cf5de79c33a46e5838af
3
+ metadata.gz: ec77e764d2dea6b44fb3fe9bd9e7900b3ff421485701b77595d24d269182c003
4
+ data.tar.gz: 924ba3849ab8533879e18c628c282e7fdef3acfd5f42a775905facd11d4f6ff1
5
5
  SHA512:
6
- metadata.gz: f3a876cf461fbf431e8be90fd8cf416077e2abb26a566548f88197a462c241dc337773a62ae6be8c748b510de8e1343de16db47be0977ed0955c53f22460f0df
7
- data.tar.gz: 8510c3620b25e95188e0952f18e0eb52cc126adee5a165bb4a123770cbc6e4339b841b7fad44ac6b895b13aa8fd2b38b9defd8e696387cdbac427dc200b5eda9
6
+ metadata.gz: 2339f84f63e976850aa2dd08bca7b3524e07a61e18bc666c805d337da34b9ce74567dd6eb9b8bcb9ac9a930cf8b268619846b423ad6b8a13416aa332214ec633
7
+ data.tar.gz: ff4c6ee591f04fac8a1dd1110584ad515558d1f5e6496654debe1815d1af2b2b218e5c32f1a82de00576c51eef1ca6834ba8b0749a8085628b39745734159331
@@ -2,7 +2,7 @@
2
2
  require 'benchmark'
3
3
  class ListComprehension
4
4
 
5
- attr_reader :c, :version, :cache
5
+ attr_reader :c, :version, :cache, :caching
6
6
  def [](*args)
7
7
  c[*args]
8
8
  end
@@ -12,6 +12,7 @@ class ListComprehension
12
12
  @caching = true
13
13
  @version = RUBY_VERSION
14
14
  @c = ->x {
15
+ raise 'please use "x" as block parameter name for now' if x[3..5] != ' x '
15
16
  # save a pristine copy of call for caching
16
17
  y = x[0..-1]
17
18
  # check for cached results
@@ -62,11 +63,11 @@ class ListComprehension
62
63
  # check Ruby Version stored in @version
63
64
  if @version >= '2.7.0'
64
65
  return instance_eval(iterable).filter_map do |x|
65
- instance_eval(map_condition.join(' ')) if eval(if_condition.join(' '))
66
+ instance_eval(map_condition.join(' ')) if instance_eval(if_condition.join(' '))
66
67
  end
67
68
  else
68
69
  return instance_eval(iterable).map do |x|
69
- instance_eval(map_condition.join(' ')) if eval(if_condition.join(' ')).compact!
70
+ instance_eval(map_condition.join(' ')) if instance_eval(if_condition.join(' ')).compact!
70
71
  end
71
72
  end
72
73
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_list_comprehension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Michael