proxy_method 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52db94c79b99c5ba157644315140141d0335fbaccf6f81c129e1bc1506c0685d
4
- data.tar.gz: 7e8e77e4e16f678e4f26fb942fdc3b9d02c78ee49b738d34b92e5eb1a3e5b1f6
3
+ metadata.gz: 24ca488f978dad8e8e25322a58dd6232a2c00328d04e2aef469f88662072f400
4
+ data.tar.gz: 7de24e7fe1d26f498c5d612c2ac1a0a271e0496f60ee0f53fe3142a35d2a2221
5
5
  SHA512:
6
- metadata.gz: 8bc83c1b4c1a8fd011042d9d0a0ecbdd7155a6a501eea01255d9d2c55c06f921407ef6faf14e8b553267350d21540ee3b7fc7a312c8bc1838ebb5380f089f88e
7
- data.tar.gz: df971e7483eaf4655e22a0703d6e79f30a4b25e2ca46153a115b3e18606e171df97770c773f9b56f0a2081c81c79b59d0830b07b32cea0d6678da36193fb6582
6
+ metadata.gz: 8d2f4e73198e258a8eb317c4a5d99f2200ed84c01e008a789747607c82f433cd8f85204f9e4aa81c7a857e551b08c0e4db68194d5672c2af3aee8f2ad76679cf
7
+ data.tar.gz: 3bc2a09859f529ddec2337b6bafde944e297c07f5b1a2623c8c24ce9f26d4cc11b1cbe38778106897d19df12e393c53c01a668449ebf2e799e338f525e4c71bf
@@ -1,3 +1,3 @@
1
1
  module ProxyMethod
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -0,0 +1,29 @@
1
+ class Animal
2
+ def self.create target=nil
3
+ ['created', target].compact.join(' ')
4
+ end
5
+
6
+ def self.destroy_all
7
+ 'destroyed'
8
+ end
9
+
10
+ def self.blocky(first, second)
11
+ yield(first, second)
12
+ end
13
+
14
+ def save
15
+ 'saved'
16
+ end
17
+
18
+ def update target=nil
19
+ ['updated', target].compact.join(' ')
20
+ end
21
+
22
+ def blocky(first, second)
23
+ yield(first, second)
24
+ end
25
+ end
26
+
27
+ Dir[File.dirname(__FILE__) + '/animal/**/*.rb'].each do |file|
28
+ require file
29
+ end
@@ -0,0 +1,5 @@
1
+ class ArgumentativeAardvark < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_method :blocky
5
+ end
@@ -0,0 +1,6 @@
1
+ class DefaultDuck < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_class_method :create
5
+ proxy_method :save
6
+ end
@@ -0,0 +1,11 @@
1
+ class MethodicalMeerkat < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_class_method(:create) do |klass, method_name, *args, &block|
5
+ 'indirectly ' + klass.send(method_name, *args, &block) + '!'
6
+ end
7
+
8
+ proxy_method(:save) do |object, method_name, *args, &block|
9
+ 'indirectly ' + object.send(method_name, *args, &block) + '!'
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class MultiMonkey < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_class_method [:create, :destroy_all]
5
+ proxy_method [:save, :update]
6
+ end
@@ -0,0 +1,6 @@
1
+ class PrefixPelican < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_class_method :create, prefix: 'pelican_'
5
+ proxy_method :save, prefix: 'pelican_'
6
+ end
@@ -0,0 +1,7 @@
1
+ class Turtle < Animal
2
+ include ProxyMethod
3
+
4
+ proxy_class_method :create, raise: "Don't Create directly, use Interactor!"
5
+ proxy_instance_method :update, raise: "Don't Update directly, use Interactor!"
6
+ proxy_method :save, raise: "Don't Save directly, use Interactor!"
7
+ end
@@ -1,78 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
  require 'proxy_method'
3
-
4
- class Animal
5
- def self.create target=nil
6
- ['created', target].compact.join(' ')
7
- end
8
-
9
- def self.destroy_all
10
- 'destroyed'
11
- end
12
-
13
- def self.blocky(first, second)
14
- yield(first, second)
15
- end
16
-
17
- def save
18
- 'saved'
19
- end
20
-
21
- def update target=nil
22
- ['updated', target].compact.join(' ')
23
- end
24
-
25
- def blocky(first, second)
26
- yield(first, second)
27
- end
28
- end
29
-
30
- class Turtle < Animal
31
- include ProxyMethod
32
-
33
- proxy_class_method :create, raise: "Don't Create directly, use Interactor!"
34
- proxy_instance_method :update, raise: "Don't Update directly, use Interactor!"
35
- proxy_method :save, raise: "Don't Save directly, use Interactor!"
36
- end
37
-
38
- class DefaultDuck < Animal
39
- include ProxyMethod
40
-
41
- proxy_class_method :create
42
- proxy_method :save
43
- end
44
-
45
- class MultiMonkey < Animal
46
- include ProxyMethod
47
-
48
- proxy_class_method [:create, :destroy_all]
49
- proxy_method [:save, :update]
50
- end
51
-
52
- class PrefixPelican < Animal
53
- include ProxyMethod
54
-
55
- proxy_class_method :create, prefix: 'pelican_'
56
- proxy_method :save, prefix: 'pelican_'
57
- end
58
-
59
- class ArgumentativeAardvark < Animal
60
- include ProxyMethod
61
-
62
- proxy_method :blocky
63
- end
64
-
65
- class MethodicalMeerkat < Animal
66
- include ProxyMethod
67
-
68
- proxy_class_method(:create) do |klass, method_name, *args, &block|
69
- 'indirectly ' + klass.send(method_name, *args, &block) + '!'
70
- end
71
-
72
- proxy_method(:save) do |object, method_name, *args, &block|
73
- 'indirectly ' + object.send(method_name, *args, &block) + '!'
74
- end
75
- end
3
+ require_relative './samples/animal'
76
4
 
77
5
  class ProxyMethodTest < MiniTest::Test
78
6
  describe "proxying class methods" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_method
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaime Bellmyer
@@ -35,6 +35,13 @@ files:
35
35
  - Rakefile
36
36
  - lib/proxy_method.rb
37
37
  - lib/proxy_method/version.rb
38
+ - test/samples/animal.rb
39
+ - test/samples/animal/argumentative_aardvark.rb
40
+ - test/samples/animal/default_duck.rb
41
+ - test/samples/animal/methodical_meerkat.rb
42
+ - test/samples/animal/multi_monkey.rb
43
+ - test/samples/animal/prefix_pelican.rb
44
+ - test/samples/animal/turtle.rb
38
45
  - test/test_proxy_method.rb
39
46
  homepage: https://github.com/Intellifarm/proxy_method
40
47
  licenses: