mirroring_test 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/mirroring_test.rb +31 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 820d2afb55da2cf69a3bc2aa663c70a797967e1dfe8c5b2a23e14d6bf80116cf
|
4
|
+
data.tar.gz: f731d0ec78d34dd3c4230b5b03029e8960e5f01e9529a8dd68ab14e444697586
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '03049dd3c5413c9d7ea32ee0f1ff3141c27461fcefd45443b59c8b516a4c88e5faa32d95086f713bef3e680bf93a3309a5ad879fac18bc9c1118cfadaf0e7da1'
|
7
|
+
data.tar.gz: 9a275f9a0c48c65e7b50684f972b12de344005eaea8e57a3e9434157bc2eae53ed462e75bd0bc9e85b99cf8139aa334355515ea4ef1c8ea213d1dc417b110260
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Call a same method for multiple receivers
|
4
|
+
class MirroringTest
|
5
|
+
def initialize(*receivers)
|
6
|
+
@receivers = receivers
|
7
|
+
end
|
8
|
+
|
9
|
+
def class
|
10
|
+
@receivers.first.class
|
11
|
+
end
|
12
|
+
|
13
|
+
def is_a?(mod)
|
14
|
+
@receivers.first.is_a?(mod)
|
15
|
+
end
|
16
|
+
|
17
|
+
alias kind_of? is_a?
|
18
|
+
alias instance_of? is_a?
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def method_missing(method_name, *args, &block) # rubocop:disable Style/MethodMissingSuper
|
23
|
+
@receivers.map do |r|
|
24
|
+
r.send(method_name, *args, &block) if r.respond_to?(method_name)
|
25
|
+
end.first
|
26
|
+
end
|
27
|
+
|
28
|
+
def respond_to_missing?(symbol, include_private)
|
29
|
+
@receivers.first.respond_to?(symbol) ? true : super
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mirroring_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taishi Kasuga
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Call a same method for multiple receivers
|
14
|
+
email: supercaracal@yahoo.co.jp
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/mirroring_test.rb
|
20
|
+
homepage: https://github.com/supercaracal/mirroring-test-gem
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.4.0
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.1.2
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Call a same method for multiple receivers
|
43
|
+
test_files: []
|