ruby_list_comprehension 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruby_list_comprehension.rb +5 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da0d475e01e660a109eff36d8f0f4f8ca3e105757bf6577bfdce20c7440177b5
|
4
|
+
data.tar.gz: e36bcd2fa8ba9e34fce4f78efb9f4853e7fff9469573dc1da1eb3fc447e17d4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0116246f99df3cb5f403963e4743fcc34c88d9767434c9505454078b29c8a0814f84ec7ca21a22ffc309b433a4dd5f7c1944a1b695049196f09253072f379d1f
|
7
|
+
data.tar.gz: 905a24fdd92c58f87e4cf7e0539f0b711e7689564e825a1a84168609a1a320b9e9856ad5544fb5c2e25cbdfbfe721fb3186c34334ac031d4905c28ce20bab149
|
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'readline'
|
3
3
|
require 'singleton'
|
4
4
|
require 'set'
|
5
|
-
module
|
5
|
+
module RubyListComprehension
|
6
6
|
FM_REGEX = /for(?<parameter>.*)(?=in)in(?<iterable>.*)(?=do)do(?<mappable>.*)(?=if)if(?<filterable>.+)end/.freeze
|
7
7
|
F_REGEX = /for(?<parameter>.*)(?=in)in(?<iterable>.*)(.+)do(.+)(?=if)if(?<filterable>.*)end/.freeze
|
8
8
|
M_REGEX = /(?=for)for(?<parameter>.*)(?=in)in(?<iterable>.*)(?=do)do(?<mappable>.*)(?=end)end/.freeze
|
@@ -169,8 +169,8 @@ module RubyList
|
|
169
169
|
end
|
170
170
|
|
171
171
|
class ListComprehension
|
172
|
-
include Singleton
|
173
|
-
include
|
172
|
+
# include Singleton
|
173
|
+
include RubyListComprehension
|
174
174
|
attr_accessor :cache, :caching, :mappable, :filterable, :iterable, :var, :list, :location, :line, :count
|
175
175
|
attr_accessor :flattener, :len, :nested, :nested_var, :file, :list_comp, :final_iterable_value
|
176
176
|
attr_accessor :count
|
@@ -205,7 +205,7 @@ module RubyList
|
|
205
205
|
def locate_list_repl
|
206
206
|
@line = Readline::HISTORY.to_a.reverse.uniq.reverse[-1]
|
207
207
|
start = @line.index('l[') + 2
|
208
|
-
ending = @line[start..-1].index('end') +
|
208
|
+
ending = @line[start..-1].index('end') + 6
|
209
209
|
@line = @line[start...ending]
|
210
210
|
end
|
211
211
|
|
@@ -219,7 +219,6 @@ module RubyList
|
|
219
219
|
def locate_list_file
|
220
220
|
@location = caller_locations.last.to_s.scan(/\d+/).last.to_i
|
221
221
|
@line = retrieve_file_data[@location - 1].strip.match(/\$l(?<line>.+)/)[:line][0...-1]
|
222
|
-
|
223
222
|
# if @line.is_a? Array
|
224
223
|
# @line.each_with_index do |list, idx|
|
225
224
|
# list.split[3] == iterable.to_s
|
@@ -227,8 +226,7 @@ module RubyList
|
|
227
226
|
# end
|
228
227
|
# end
|
229
228
|
@line
|
230
|
-
|
231
229
|
end
|
232
230
|
end
|
233
|
-
$l = ListComprehension.
|
231
|
+
$l = ListComprehension.new
|
234
232
|
end
|