simple_delegate 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/simple_delegate.rb +3 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48d896cdb9f315a0938d27ed10455c41136b3220843f39503dec976259c5fdce
4
- data.tar.gz: 70cedf4efbc0ba29d296a279a2556e19c2b34e022d4ba1357193c694af2d9194
3
+ metadata.gz: 5a693bf1d51193e9c2a9f61fd69783389e6baa861b3278a822e26a04d75247c3
4
+ data.tar.gz: e531e415c819e3d533847668d6911ce3d6f84d8ad2ee853a426652e2c37d996c
5
5
  SHA512:
6
- metadata.gz: 839a75c88cf8342056ba445a67918ce19eb7b4bd35917f8fbfbb2ff29012cfeecc72912b6b8b9057b113b9eb043668f81594a8850609a2e2dc8491bd3a047752
7
- data.tar.gz: 3adc127b5c42e424849938a64cebd1f014706d4b5c6aa2538e5b3b5169d6749989791a4f36121da75ad5c6590591d676362149798fffa1f51d38c246930fde8b
6
+ metadata.gz: d4e2142d53a453b9ffc52210abd38e61dc7c21b9f0337e53ea2d8fa7667443697294e579f7f4b99688733d2566269e10e9fa6fa4ba6094e8946dd8763aeebbf4
7
+ data.tar.gz: 7dfbb19aeafa7cd1afa1aad974b1a0bdedcd2b9b18f3df0f4371f98571322b74d72bd8ff98df208bc9751d13a01aff631a56c4f28ef3833168ae6267ee78b4b6
@@ -4,11 +4,9 @@ module SimpleDelegate
4
4
  end
5
5
 
6
6
  module ClassMethods
7
- def delegate(*args)
8
- opts = args.pop
9
-
7
+ def delegate(*args, **opts)
10
8
  args.each do |method|
11
- define_method(method) do |*method_args, &method_blk|
9
+ define_method(method) do |*method_args, **method_opts, &method_blk|
12
10
  if opts[:to_instance_variable]
13
11
  object = instance_variable_get("@#{opts.fetch(:to_instance_variable)}")
14
12
  raise "Nothing was returned by: #{opts.fetch(:to_instance_variable)}" unless object
@@ -19,7 +17,7 @@ module SimpleDelegate
19
17
  raise "Don't know where to delegate to"
20
18
  end
21
19
 
22
- object.__send__(method, *method_args, &method_blk)
20
+ object.__send__(method, *method_args, **method_opts, &method_blk)
23
21
  end
24
22
  end
25
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_delegate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.1.6
143
+ rubygems_version: 3.2.32
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: A simple library to delegate methods to instance variables