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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4ec59ecef09b36ae718c8b4e15386620803a609
4
- data.tar.gz: b986fb672cac0ef9bb05408baa499885a3124779
3
+ metadata.gz: c0acfec4f4348a5b9566c217395fd29a0add7e24
4
+ data.tar.gz: 26cb7afa178ce703ffebb394f29621ae52237021
5
5
  SHA512:
6
- metadata.gz: 45c8476b26ea171fec07746bd53c7f56e45f8ef3e5126d11456c11448d4215fad3785c5ab18de5a2b55c695df4f36e06118ca0811471115081e6f6cfeee49b1e
7
- data.tar.gz: a5462e8eecf041017b4a44a83df9a4502ef22cf43a22c9bf1080fb2897181fcc9badf4c9e9297d8a64d13879b1ed22ed0fb32c870dedaedcdc6f1adff249a819
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
@@ -4,11 +4,7 @@ module EnumArgs
4
4
  class Enumerator
5
5
  include Enumerable
6
6
 
7
- attr_reader :object, :method_name, :args, :using, :yield_handler
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: {}, &yield_handler)
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, &yield_handler
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
@@ -1,3 +1,3 @@
1
1
  module EnumArgs
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_args
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro Martinez Ruiz