totally_lazy 0.1.48 → 0.1.49

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDFiMzI4NzkzYTJlYWRjYWZjMmEzNGM1ZGI5ZTRkOTY4YjlkYWEzZg==
4
+ Yjc0NjEyODg0MmY0ODA0NDA4M2I1MWQ2MTU3YTJhMDEzZmQ2MGYxOA==
5
5
  data.tar.gz: !binary |-
6
- NDQ0MDZjZWIxMTYzY2NjZjk0OTYyN2FkNDkwNDU1MTIyOTlmNzczMg==
6
+ YTYzOTAwNTc2NDI3MDg2ODhhZTIzNWJjZjhhODczZmMyZDgwM2I5OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTNiMTEyZDY0ZDdlMDEwMDc2NTIzMTg2ZjkwODc5N2I5MTA4MWQ1MGY2MzA2
10
- M2FjYmQzYjI3NTBjNjk1OGU4OGZmODM1ZWE2ZDNiNWNmN2VjNDE1YzYxODg1
11
- NWUzZjMxNWIxYmRiMWI4ZmE3ZTkzYjRkZmJlZjY1ZjI0ZjlkOGM=
9
+ YThjMDgwYjkzOWI0OTBjYjZlNDgzZGQ1Yjk2ZmFjMjk0MmVkMzc4NGFlN2Jj
10
+ OWU2Mzc3MjU5MGY5ODBhNzc1OTA5ZDQ4NGM2ZGFhM2E3MmZiNDA3ZWY3ZGE2
11
+ ZTliZGYwMzc5OTFmN2RkNTc0MzIyYjA4NGE0ZjRkMWExM2MzZTg=
12
12
  data.tar.gz: !binary |-
13
- ZWQwMWIzNzUzZWNkZThjM2QxMWM2MGZiZjRhODhhNWVkODhhZjYwZDg1YzM5
14
- MDJmYmM2YWIyNmVkYzM1NWU0MDRkNDBlYjBkYzZiMDk4ZTRiNmJhYTBhNzRi
15
- NWExNTUzMTg5YWRjNTUyYjlmNmVjMDc4MTRiMDQ2MTNmNDA0M2Q=
13
+ ZGUxZDg4Y2ZmZWQ3MjczM2RiYWUyNmNhYWQwY2MxMWZhYzQzOTk4M2NjNGIz
14
+ MzFjMTZiZDc4NWFiZmE3YzgxZTE2Nzk2OGFjNmM5ZGRlNTNjNmRmZmZhYzIy
15
+ OWI1OGU3ZmJkNGRlMmMyMTUzYjkyYjJhMTJjNjEzNmZjMDI5MDM=
@@ -36,7 +36,7 @@ module Functions
36
36
 
37
37
  alias call_throws call_raises
38
38
 
39
- def call
39
+ def call_fn
40
40
  ->(fn) { fn.() }
41
41
  end
42
42
 
@@ -70,9 +70,7 @@ module Functions
70
70
  end
71
71
 
72
72
  def as_promise
73
- -> (fn) {
74
- Concurrent::Promise.new { fn.() }
75
- }
73
+ -> (fn) { Concurrent::Promise.new { fn.() } }
76
74
  end
77
75
 
78
76
  def execute_with(pool)
@@ -313,7 +313,8 @@ class Sequence
313
313
  end
314
314
 
315
315
  def to_s
316
- "[#{self.is_empty? ? '' : self.take(100).reduce(join_with_sep(','))}]"
316
+ sample = take(100).to_a.to_seq
317
+ "[#{sample.is_empty? ? '' : sample.reduce(join_with_sep(','))}]"
317
318
  end
318
319
 
319
320
  private
@@ -64,7 +64,7 @@ describe 'Sequence' do
64
64
  end
65
65
 
66
66
  it 'should ensure map is lazy' do
67
- result = sequence(returns(1), call_raises(RuntimeError.new)).map(call)
67
+ result = sequence(returns(1), call_raises(RuntimeError.new)).map(call_fn)
68
68
  expect(result.head).to eq(1)
69
69
  end
70
70
 
@@ -74,7 +74,7 @@ describe 'Sequence' do
74
74
  end
75
75
 
76
76
  it 'should ensure filter is lazy' do
77
- result = sequence(returns(1), returns(2), call_raises(RuntimeError.new)).map(call).filter(even)
77
+ result = sequence(returns(1), returns(2), call_raises(RuntimeError.new)).map(call_fn).filter(even)
78
78
  expect(result.head).to eq(2)
79
79
  end
80
80
 
@@ -208,6 +208,7 @@ describe 'Sequence' do
208
208
  it 'should support flatten' do
209
209
  expect(sequence('Hello').map(to_characters).flatten).to eq(sequence('H', 'e', 'l', 'l', 'o'))
210
210
  expect(sequence(some(1), none, some(3)).flatten).to eq(sequence(1, 3))
211
+ expect(sequence(sequence(1)).flatten).to eq(sequence(1))
211
212
  end
212
213
 
213
214
  it 'should support drop' do
@@ -291,6 +292,7 @@ describe 'Sequence' do
291
292
  it 'should be able to display sequence as a string' do
292
293
  expect(sequence(1,2,3,4,5).to_s).to eq('[1,2,3,4,5]')
293
294
  expect(empty.to_s).to eq('[]')
295
+ expect(sequence(sequence(1)).flatten.to_s).to eq('[1]')
294
296
  end
295
297
 
296
298
  it 'should raise exception if you try to use both lambda and block' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totally_lazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.48
4
+ version: 0.1.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow