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.
- checksums.yaml +4 -4
- data/lib/simple_delegate.rb +3 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a693bf1d51193e9c2a9f61fd69783389e6baa861b3278a822e26a04d75247c3
|
4
|
+
data.tar.gz: e531e415c819e3d533847668d6911ce3d6f84d8ad2ee853a426652e2c37d996c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4e2142d53a453b9ffc52210abd38e61dc7c21b9f0337e53ea2d8fa7667443697294e579f7f4b99688733d2566269e10e9fa6fa4ba6094e8946dd8763aeebbf4
|
7
|
+
data.tar.gz: 7dfbb19aeafa7cd1afa1aad974b1a0bdedcd2b9b18f3df0f4371f98571322b74d72bd8ff98df208bc9751d13a01aff631a56c4f28ef3833168ae6267ee78b4b6
|
data/lib/simple_delegate.rb
CHANGED
@@ -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.
|
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.
|
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
|