enum_args 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/enum_args/enumerator.rb +7 -8
- data/lib/enum_args/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0acfec4f4348a5b9566c217395fd29a0add7e24
|
4
|
+
data.tar.gz: 26cb7afa178ce703ffebb394f29621ae52237021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d2c196467fc821139d64dcb2a9936d3fcd1b036e6e875c16f8bed0db5f76959dab910c63b123a762bd8cef55d5248673d12b87930ed325d89c139d9bdc37cef
|
7
|
+
data.tar.gz: ee3b7bc71bf6a64e12d7c7491c48878fe4ec5fa9d25774ac95acc2797c11463c6377a1990f6ca8f820a280c0e9d42904ccd83de3d1f259c37cf49d89c0fb4937
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015 Alejandro Martinez Ruiz
|
3
|
+
Copyright (c) 2015 Alejandro Martinez Ruiz <alex at flawedcode . org>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/enum_args/enumerator.rb
CHANGED
@@ -4,11 +4,7 @@ module EnumArgs
|
|
4
4
|
class Enumerator
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
attr_reader :object, :method_name, :args, :using
|
8
|
-
|
9
|
-
DEFAULT_YIELD_HANDLER = ->(*yielded_values) do
|
10
|
-
Fiber.yield(*yielded_values)
|
11
|
-
end
|
7
|
+
attr_reader :object, :method_name, :args, :using
|
12
8
|
|
13
9
|
def args=(args)
|
14
10
|
@args = args
|
@@ -16,18 +12,19 @@ module EnumArgs
|
|
16
12
|
@args
|
17
13
|
end
|
18
14
|
|
15
|
+
# :nocov:
|
19
16
|
def using=(using)
|
20
17
|
@using = using
|
21
18
|
self.args = args
|
22
19
|
@using
|
23
20
|
end
|
21
|
+
# :nocov:
|
24
22
|
|
25
|
-
def initialize(object, method_name, *fixed_args, using: {}
|
23
|
+
def initialize(object, method_name, *fixed_args, using: {})
|
26
24
|
@object = object
|
27
25
|
@method_name = method_name
|
28
26
|
@using = using # don't use self.using=() here, since we can't call it yet
|
29
27
|
self.args = fixed_args
|
30
|
-
@yield_handler = yield_handler || DEFAULT_YIELD_HANDLER
|
31
28
|
rewind
|
32
29
|
end
|
33
30
|
|
@@ -42,7 +39,9 @@ module EnumArgs
|
|
42
39
|
|
43
40
|
def rewind
|
44
41
|
self.fiber = Fiber.new do
|
45
|
-
object.send method_name, *args
|
42
|
+
object.send method_name, *args do |*yielded_values|
|
43
|
+
Fiber.yield(*yielded_values)
|
44
|
+
end
|
46
45
|
raise StopIteration
|
47
46
|
end
|
48
47
|
self
|
data/lib/enum_args/version.rb
CHANGED