eitil 1.1.20 → 1.1.21
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcfbc894bc4eedf0e052f4163ddf1c37f668b510a3c50840a9ec569f12ac3aa2
|
4
|
+
data.tar.gz: 339468c8001ddca581a733fcccb7714498aa1b200b271852493fca7ae71c7a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1b8b6a8287b19abaaac036badf38a78605f2b5b5e2ed5d3a3826bf193e78b9dbc83d0b9e7a740b9a0cafc8ed18c42971bdf7dd0098361ef58ce34df18af578e
|
7
|
+
data.tar.gz: b96b86a0707d073316140829718482025abffca8511784a4ef7e0a9141423a0008a0e77e378d5d6ae8c012e2093f4345f40d8d352d08510b6f353a892ffb39ca
|
data/eitil_wrapper/README.md
CHANGED
@@ -59,15 +59,15 @@ decorate(dec_item, dec_method: nil, dec_class: nil, **dec_kwargs)
|
|
59
59
|
|
60
60
|
### Configuration
|
61
61
|
|
62
|
-
1. Your decorator classes should inherit from
|
63
|
-
2. Your controllers should inherit the module
|
64
|
-
3. If you set controller ivars for each request, you can make them available in your decorators by providing Eitil
|
62
|
+
1. Your decorator classes should inherit from EitilWrapper::ApplicationDecorator.
|
63
|
+
2. Your controllers should inherit the module EitilWrapper::ControllerDecorator, through inclusion in a superclass.
|
64
|
+
3. If you set controller ivars for each request, you can make them available in your decorators by providing Eitil with the names of your ivars as an array of symbols:
|
65
65
|
|
66
66
|
```ruby
|
67
67
|
# initializers/eitil.rb
|
68
68
|
|
69
69
|
Eitil.set_config do |config|
|
70
|
-
config.
|
70
|
+
config.controller_ivars = [:user, :env]
|
71
71
|
end
|
72
72
|
```
|
73
73
|
|
@@ -70,8 +70,8 @@ module EitilWrapper
|
|
70
70
|
became_method = "#{column_name}_became_true"
|
71
71
|
|
72
72
|
define_method(method_name) do
|
73
|
-
|
74
|
-
|
73
|
+
return send(becomes_method) if changes&.present?
|
74
|
+
return send(became_method) if previous_changes&.present?
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -99,8 +99,8 @@ module EitilWrapper
|
|
99
99
|
became_method = "#{column_name}_became_false"
|
100
100
|
|
101
101
|
define_method(method_name) do
|
102
|
-
|
103
|
-
|
102
|
+
return send(becomes_method) if changes&.present?
|
103
|
+
return send(became_method) if previous_changes&.present?
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -19,7 +19,7 @@ module EitilWrapper
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def inform_no_method_for_decorator_error
|
22
|
-
message = "Warning: NoMethodError for #{@dec_class}
|
22
|
+
message = "Warning: NoMethodError for #{@dec_class}##{@dec_method}, returned @dec_item instead."
|
23
23
|
Logger.new("#{Rails.root}/log/decorator_log.log").warn message
|
24
24
|
warn message
|
25
25
|
end
|
@@ -51,7 +51,7 @@ module EitilWrapper
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def controller_ivars
|
54
|
-
|
54
|
+
Eitil.controller_ivars.map do |ivar|
|
55
55
|
{ ivar => instance_variable_get("@#{ivar.to_s}") }
|
56
56
|
end.inject &:merge
|
57
57
|
end
|
data/lib/eitil/railtie.rb
CHANGED
data/lib/eitil/version.rb
CHANGED