proxy_method 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +3 -3
- data/lib/proxy_method/version.rb +1 -1
- data/lib/proxy_method.rb +2 -2
- data/test/test_proxy_method.rb +3 -3
- 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: 5a460c566052d51f5f1a31e54492446bf993f67f5fa1949eb741aa35fa883679
|
4
|
+
data.tar.gz: 8676ff3e48fc2a52b505f2c218fcbcb17543aac353745dfa8c99db7cd91b8b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac4660fcb8882adf2648a8f91bbc2851c0d59a7bb3914f037435b09c256e65ea093dd6aacbfe0a68040d654f8b3cd7aa2840e88edb80f4a7f1507e0a443ae0e2
|
7
|
+
data.tar.gz: 7c87174a537070f13eb60765e1076f136b88377e4b7e7649e4223f972a27ff7e638c10cd86d1bde9a6105b948b0777f6289dff79373a32fa88b8fafb74ccd7c1
|
data/README.md
CHANGED
@@ -58,12 +58,12 @@ You can do this:
|
|
58
58
|
Turtle.new.unproxied_save
|
59
59
|
# => 'saved'
|
60
60
|
|
61
|
-
|
61
|
+
Raise a custom error message:
|
62
62
|
|
63
63
|
class CustomCow < Animal
|
64
64
|
include ProxyMethod
|
65
65
|
|
66
|
-
proxy_method :save,
|
66
|
+
proxy_method :save, raise: "Don't save here, use an interactor!"
|
67
67
|
end
|
68
68
|
|
69
69
|
CustomCow.new.save
|
@@ -74,7 +74,7 @@ Specify multiple methods at once:
|
|
74
74
|
class MultiMonkey < Animal
|
75
75
|
include ProxyMethod
|
76
76
|
|
77
|
-
proxy_method [:save, :update],
|
77
|
+
proxy_method [:save, :update], raise: "Use an interactor!"
|
78
78
|
end
|
79
79
|
|
80
80
|
MultiMonkey.new.save
|
data/lib/proxy_method/version.rb
CHANGED
data/lib/proxy_method.rb
CHANGED
@@ -19,7 +19,7 @@ module ProxyMethod
|
|
19
19
|
def proxy_class_method(original_method_names, options = {})
|
20
20
|
original_method_names = Array(original_method_names)
|
21
21
|
|
22
|
-
error_message = options[:
|
22
|
+
error_message = options[:raise] || DEFAULT_PROXY_MESSAGE
|
23
23
|
prefix = options[:prefix] || DEFAULT_PREFIX
|
24
24
|
|
25
25
|
original_method_names.each do |original_method_name|
|
@@ -40,7 +40,7 @@ module ProxyMethod
|
|
40
40
|
def proxy_instance_method(original_method_names, options = {})
|
41
41
|
original_method_names = Array(original_method_names)
|
42
42
|
|
43
|
-
error_message = options[:
|
43
|
+
error_message = options[:raise] || DEFAULT_PROXY_MESSAGE
|
44
44
|
prefix = options[:prefix] || DEFAULT_PREFIX
|
45
45
|
|
46
46
|
original_method_names.each do |original_method_name|
|
data/test/test_proxy_method.rb
CHANGED
@@ -30,9 +30,9 @@ end
|
|
30
30
|
class Turtle < Animal
|
31
31
|
include ProxyMethod
|
32
32
|
|
33
|
-
proxy_class_method :create,
|
34
|
-
proxy_instance_method :update,
|
35
|
-
proxy_method :save,
|
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
36
|
end
|
37
37
|
|
38
38
|
class DefaultDuck < Animal
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxy_method
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Bellmyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
The purpose of this gem is to prevent directly running the inherited
|