eitil 1.0.1.e.2 → 1.0.1.e.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/eitil_core/README.md +288 -0
  3. data/eitil_core/lib/eitil_core/application_controller/slice_params.rb +14 -0
  4. data/eitil_core/lib/eitil_core/application_controller.rb +2 -0
  5. data/eitil_core/lib/eitil_core/application_record/all_associations.rb +16 -0
  6. data/eitil_core/lib/eitil_core/application_record/find_by_like.rb +15 -0
  7. data/eitil_core/lib/eitil_core/application_record/where_like.rb +15 -0
  8. data/eitil_core/lib/eitil_core/application_record.rb +4 -0
  9. data/eitil_core/lib/eitil_core/argument_helpers/all_args_to_ivars.rb +12 -0
  10. data/eitil_core/lib/eitil_core/argument_helpers/all_kwargs_to_ivars.rb +12 -0
  11. data/eitil_core/lib/eitil_core/argument_helpers/args_to_ivars.rb +12 -0
  12. data/eitil_core/lib/eitil_core/argument_helpers.rb +5 -0
  13. data/eitil_core/lib/eitil_core/concerns/include_concerns_of.rb +15 -0
  14. data/eitil_core/lib/eitil_core/concerns.rb +2 -0
  15. data/eitil_core/lib/eitil_core/datetime/prettify.rb +10 -0
  16. data/eitil_core/lib/eitil_core/datetime.rb +2 -0
  17. data/eitil_core/lib/eitil_core/errors/raise_error.rb +11 -0
  18. data/eitil_core/lib/eitil_core/errors.rb +2 -0
  19. data/eitil_core/lib/eitil_core/float/safe_to_i.rb +9 -0
  20. data/eitil_core/lib/eitil_core/float.rb +2 -0
  21. data/eitil_core/lib/eitil_core/hash/auto_dig.rb +17 -0
  22. data/eitil_core/lib/eitil_core/hash.rb +2 -0
  23. data/eitil_core/lib/eitil_core/lookups/all_methods.rb +32 -0
  24. data/eitil_core/lib/eitil_core/lookups.rb +2 -0
  25. data/eitil_core/lib/eitil_core/railtie.rb +37 -0
  26. data/eitil_core/lib/eitil_core/safe_executions/safe_call.rb +12 -0
  27. data/eitil_core/lib/eitil_core/safe_executions/safe_send.rb +12 -0
  28. data/eitil_core/lib/eitil_core/safe_executions.rb +3 -0
  29. data/eitil_core/lib/eitil_core/setters/set_ivars.rb +12 -0
  30. data/eitil_core/lib/eitil_core/setters.rb +2 -0
  31. data/eitil_core/lib/eitil_core/type_checkers/is_num_or_nan.rb +96 -0
  32. data/eitil_core/lib/eitil_core/type_checkers.rb +2 -0
  33. data/eitil_core/lib/eitil_core/validations/run_validations.rb +10 -0
  34. data/eitil_core/lib/eitil_core/validations.rb +2 -0
  35. data/eitil_core/lib/eitil_core.rb +24 -0
  36. data/eitil_integrate/README.md +8 -0
  37. data/eitil_integrate/lib/eitil_integrate/railtie.rb +10 -0
  38. data/eitil_integrate/lib/eitil_integrate.rb +0 -0
  39. data/eitil_store/README.md +16 -0
  40. data/eitil_store/lib/eitil_store/railtie.rb +10 -0
  41. data/eitil_store/lib/eitil_store/regex/regex.rb +41 -0
  42. data/eitil_store/lib/eitil_store/regex.rb +4 -0
  43. data/eitil_store/lib/eitil_store.rb +4 -0
  44. data/eitil_support/README.md +78 -0
  45. data/eitil_support/lib/eitil_support/directory/lookups.rb +23 -0
  46. data/eitil_support/lib/eitil_support/directory.rb +2 -0
  47. data/eitil_support/lib/eitil_support/railtie.rb +10 -0
  48. data/eitil_support/lib/eitil_support/stacktrace/audit.rb +15 -0
  49. data/eitil_support/lib/eitil_support/stacktrace/call.rb +17 -0
  50. data/eitil_support/lib/eitil_support/stacktrace/stack.rb +28 -0
  51. data/eitil_support/lib/eitil_support/stacktrace.rb +4 -0
  52. data/eitil_support/lib/eitil_support.rb +5 -0
  53. data/eitil_wrapper/README.md +181 -0
  54. data/eitil_wrapper/lib/eitil_wrapper/decorators/application_decorator.rb +19 -0
  55. data/eitil_wrapper/lib/eitil_wrapper/decorators/controller_decorator.rb +60 -0
  56. data/eitil_wrapper/lib/eitil_wrapper/decorators.rb +3 -0
  57. data/eitil_wrapper/lib/eitil_wrapper/jobs/new_job.rb +34 -0
  58. data/eitil_wrapper/lib/eitil_wrapper/jobs/new_job_debugger.rb +37 -0
  59. data/eitil_wrapper/lib/eitil_wrapper/jobs/single_method_job.rb +8 -0
  60. data/eitil_wrapper/lib/eitil_wrapper/jobs.rb +4 -0
  61. data/eitil_wrapper/lib/eitil_wrapper/railtie.rb +49 -0
  62. data/eitil_wrapper/lib/eitil_wrapper/routes/extended_resources.rb +40 -0
  63. data/eitil_wrapper/lib/eitil_wrapper/routes.rb +2 -0
  64. data/eitil_wrapper/lib/eitil_wrapper/scopes/default_scopes.rb +80 -0
  65. data/eitil_wrapper/lib/eitil_wrapper/scopes.rb +2 -0
  66. data/eitil_wrapper/lib/eitil_wrapper.rb +7 -0
  67. data/lib/eitil/all.rb +18 -0
  68. data/lib/eitil/engine.rb +38 -0
  69. data/lib/eitil/railtie.rb +6 -0
  70. data/lib/eitil/version.rb +5 -0
  71. data/lib/eitil.rb +6 -0
  72. data/lib/tasks/eitil_tasks.rake +4 -0
  73. metadata +72 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 161ea1fef5a7b13407bb26a3d99a8904c703892c1694810736c0730f641e979e
4
- data.tar.gz: 4c41d1d6fdd1b3b801159bc636f4c21671f70c4abae545c36ce51c84c830bc14
3
+ metadata.gz: 838e2414fac15c66b76d95da3fecd112e366bf9b860b6c2b4647efd7907fc92b
4
+ data.tar.gz: b4d80aab7d63d69522749d958673acee64764bb986421e0165a7804ef1eb0cfd
5
5
  SHA512:
6
- metadata.gz: 94ac07f583fab8447efcb1db503d64aa568ce5afd93c33bd41463b41b2e1bc9ce6ed8ce91fb7991e785626f2d2ec92ec168dc7622906bc6d41836a5fd9a5211e
7
- data.tar.gz: 8cdca2036c3c4da7bb3a733143faa3e319f1f05aea30bd049413ab7e913929f1dd277575b02e1274dc77dc8318286c98d305873733f714286b2f04aebe0908e4
6
+ metadata.gz: 454ba3ec3f1dc1538651ac29b6ca4423614e8d923c4111aadaa0e3f646e3d539cb78326989f699f9d4eaafeb0cd2357b04e92eaa0840b5680f4c2650bed46e84
7
+ data.tar.gz: 7531ed1078d5416180aa02fd9f1eeaf366787e4fbe7d05d4580d0e23308b8a9caadc5e4f7fd25c0fa1e3dbae2dfae6ff20b9b8e86d39c6be87cb14b19ca051f9
@@ -0,0 +1,288 @@
1
+
2
+
3
+
4
+ # EitilCore
5
+
6
+ EitilCore extends the core classes of Ruby and Rails.
7
+
8
+
9
+ ## ApplicationController
10
+
11
+ ```ruby
12
+
13
+ require "eitil_core/application_controller"
14
+
15
+ ```
16
+
17
+ ```ruby
18
+ # require "eitil_core/application_controller/slice_params"
19
+
20
+ slice_params(*args)
21
+ # slices request params, converts them to JSON and symbolizes the keys
22
+ # call as: slice_params :id, :user
23
+ # => { id: 1, user: 69 }
24
+ ```
25
+
26
+
27
+ ## ApplicationRecord
28
+
29
+ ```ruby
30
+
31
+ require "eitil_core/application_controller"
32
+
33
+ ```
34
+
35
+ ```ruby
36
+ # require "eitil_core/application_record/find_by_like"
37
+
38
+ self.find_by_like(_hash)
39
+ # runs .find_by with your string field made into a wildcard and case insensitive
40
+ # call as: User.find_by_like(name: 'jurriaan')
41
+ ```
42
+
43
+ ```ruby
44
+ # require "eitil_core/application_record/where_like"
45
+
46
+ self.where_like(_hash)
47
+ # runs .where with your string field made into a wildcard and case insensitive
48
+ # call as: User.where_like(name: 'jurriaan')
49
+ ```
50
+
51
+ ```ruby
52
+ # require "eitil_core/application_record/all_associations"
53
+
54
+ self.all_associations
55
+ # returns all associations for a given model
56
+ # call as: Environment.all_associations
57
+ ```
58
+
59
+
60
+ ## ArgumentHelpers
61
+
62
+ ```ruby
63
+
64
+ require "eitil_core/arugment_helpers"
65
+
66
+ ```
67
+
68
+
69
+ ```ruby
70
+ # require "eitil_core/argument_helpers/all_args_to_ivars"
71
+
72
+ all_args_to_ivars(binding)
73
+ # sets all keywords arguments of the method's local binding to instance variables
74
+ # call as: all_args_to_ivars binding
75
+ ```
76
+
77
+
78
+ ```ruby
79
+ # require "eitil_core/argument_helpers/args_to_ivars"
80
+
81
+ args_to_ivars(binding, *local_vars)
82
+ # sets specified keywords arguments of the method's local binding to instance variables
83
+ # call as: all_args_to_ivars binding :user_id, :user_name
84
+ ```
85
+
86
+
87
+ ```ruby
88
+ # require "eitil_core/argument_helpers/all_kwargs_to_ivars"
89
+
90
+ all_kwargs_to_ivars(local_binding, namespace= :kwargs)
91
+ # sets the method's **kwargs argument to instance variables, with each key as the ivar's "@#{name}" and the value as its value
92
+ # call as: kwargs_to_ivars binding
93
+ # the keywords container name can be overwritten, e.g. the common :attributes
94
+ ```
95
+
96
+
97
+ ## Concerns
98
+
99
+ ```ruby
100
+
101
+ require "eitil_core/concerns"
102
+
103
+ ```
104
+
105
+ ```ruby
106
+ # require "eitil_core/concerns/include_concerns_of"
107
+
108
+ include_concerns_of(*directories, namespace: nil)
109
+ # includes models/concerns/{directories}/* if no namespace if given, or all concerns within the given namespace
110
+ # call as: include_concerns_of :user, :mail
111
+ # => includes all modules of models/concerns/user/* and models/oncerns/mail/*
112
+ # or call as: include_concerns_of :request_service, namespace: Eivid::Concerns
113
+ # tip: call Class.included_modules to view all included modules
114
+ ```
115
+
116
+
117
+ ## DateTime
118
+
119
+ ```ruby
120
+
121
+ require "eitil_core/datetime"
122
+
123
+ ```
124
+
125
+ ```ruby
126
+ # require "eitil_core/datetime/prettify"
127
+
128
+ prettify
129
+ # formats DateTime instances into a pretty, simple and filename friendly format
130
+ # call as: DateTime.now.prettify
131
+ # => "2021-04-21.17:51:42"
132
+ ```
133
+
134
+
135
+ ## Errors
136
+
137
+ ```ruby
138
+
139
+ require "eitil_core/errors"
140
+
141
+ ```
142
+
143
+ ```ruby
144
+ # require "eitil_core/errors/raise_error"
145
+
146
+ raise_error(_class_name, message = nil)
147
+ # creates an error class if currently undefined, inheriting from StandardError, and raises the error with the given message
148
+ # call as: raise_error "SomethingWentWrongError", "check your code, bro!"
149
+ # => SomethingWentWrongError (check your code, bro!)
150
+ ```
151
+
152
+
153
+ ## Float
154
+
155
+ ```ruby
156
+
157
+ require "eitil_core/float"
158
+
159
+ ```
160
+
161
+ ```ruby
162
+ # require "eitil_core/float/safe_to_i"
163
+
164
+ safe_to_i
165
+ # converts a float to an integer, only when no decimal values are lost.
166
+ # 8.00.safe_to_i returns 8 (Integer)
167
+ # 8.88.safe_to_i returns 8.88 (Float)
168
+ ```
169
+
170
+
171
+ ## Hash
172
+
173
+ ```ruby
174
+
175
+ require "eitil_core/hash"
176
+
177
+ ```
178
+
179
+ ```ruby
180
+ # require "eitil_core/hash/auto_dig"
181
+
182
+ auto_dig(_hash = self, _key)
183
+ # finds the value for the given hash key, irregardless of the amount of nested layers
184
+ # call as: {a: 1, b: {c: 2, d: {e: 3}}}.auto_dig :e
185
+ # => 3
186
+ ```
187
+
188
+
189
+ ## Lookups
190
+
191
+ ```ruby
192
+
193
+ require "eitil_core/lookups"
194
+
195
+ ```
196
+
197
+ ```ruby
198
+ # require "eitil_core/lookups/all_methods"
199
+
200
+ all_methods(include_ancestors = true, grep: nil)
201
+ # pretty prints all methods for any object, grouped per type (e.g. private_methods, public_instance_methods)
202
+ # call as: Class.all_methods false, grep: /json/
203
+ ```
204
+
205
+
206
+ ## SafeExecutions
207
+
208
+ ```ruby
209
+
210
+ require "eitil_core/safe_executions"
211
+
212
+ ```
213
+
214
+ ```ruby
215
+ # require "eitil_core/safe_executions/safe_send"
216
+
217
+ safe_send(method, *args, return_value: nil)
218
+ # a safe version of .send, which in case of an error rescues and returns return_value (default: nil) instead
219
+ ```
220
+
221
+ ```ruby
222
+ # require "eitil_core/safe_executions/safe_call"
223
+
224
+ safe_call(*args, return_value: nil, &block)
225
+ # a safe version of .call, which in case of an error rescues and returns return_value (default: nil) instead
226
+ # accepts either a proc argument or a block
227
+ ```
228
+
229
+
230
+ ## Setters
231
+
232
+ ```ruby
233
+
234
+ require "eitil_core/setters"
235
+
236
+ ```
237
+
238
+ ```ruby
239
+ # require "eitil_core/setters/set_ivars"
240
+
241
+ set_ivars(*ivars)
242
+ # sets instance variables named @"#{ivar}" for each symbol passed, by invoking send("set_#{ivar}")
243
+ # e.g. set_ivars(:user) sets @user with the value returned by your local method .set_user
244
+ # call as: set_ivars :user, :authentication, :connection
245
+ ```
246
+
247
+
248
+ ## TypeCheckers
249
+
250
+ ```ruby
251
+
252
+ require "eitil_core/type_checkers"
253
+
254
+ ```
255
+
256
+ ```ruby
257
+ # require "eitil_core/type_checkers/is_num_or_nan"
258
+
259
+ is_num?
260
+ # returns true if a string matches the Rubinius source code regex for strings and integers, false otherwise
261
+ # comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
262
+ # this method is also implemented for all other classes, such as Integer, Float, NilClass, TrueClass, Hash and so on...
263
+
264
+ is_nan?
265
+ # returns true if a string does NOT match the Rubinius source code regex for strings and integers, false otherwise
266
+ # comes in handy since ruby plays it safe on string to number conversion ('aaa'.to_f returns 0.0, thus is valid)
267
+ # this method is also implemented for all other classes, such as Integer, Float, NilClass, TrueClass, Hash and so on...
268
+ ```
269
+
270
+
271
+ ## Validations
272
+
273
+ ```ruby
274
+
275
+ require "eitil_core/validations"
276
+
277
+ ```
278
+
279
+ ```ruby
280
+ # require "eitil_core/validations/run_validations"
281
+
282
+ run_validations(*validations)
283
+ # calls a method for each argument, namespaced as "validate_#{argument}"
284
+ # call as: run_validations(:single_receipt, :single_order)
285
+ # => calls #validate_single_receipt and #validate_single_order
286
+ ```
287
+
288
+
@@ -0,0 +1,14 @@
1
+
2
+ # require "eitil_core/application_controller/slice_params"
3
+
4
+ module EitilCore
5
+ module ApplicationController
6
+ module SliceParams
7
+
8
+ def slice_params(*args)
9
+ params.slice(*args).as_json.symbolize_keys
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/application_controller/slice_params"
@@ -0,0 +1,16 @@
1
+
2
+ # require "eitil_core/application_record/all_associations"
3
+
4
+ module EitilCore
5
+ module ApplicationRecord
6
+ module AllAssociations
7
+
8
+ def all_associations
9
+ reflect_on_all_associations.map do |assoc|
10
+ { assoc.name => assoc.association_class.to_s.demodulize }
11
+ end.inject &:merge
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+
2
+ # require "eitil_core/application_record/find_by_like"
3
+
4
+ module EitilCore
5
+ module ApplicationRecord
6
+ module FindByLike
7
+
8
+ def find_by_like(_hash)
9
+ column, like = _hash.first
10
+ find_by("LOWER(#{column}) LIKE ?", "%#{like.downcase}%")
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+
2
+ # require "eitil_core/application_record/where_like"
3
+
4
+ module EitilCore
5
+ module ApplicationRecord
6
+ module WhereLike
7
+
8
+ def where_like(_hash)
9
+ column, like = _hash.first
10
+ where("LOWER(#{column}) LIKE ?", "%#{like.downcase}%")
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+
2
+ require "eitil_core/application_record/where_like"
3
+ require "eitil_core/application_record/find_by_like"
4
+ require "eitil_core/application_record/all_associations"
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/argument_helpers/all_args_to_ivars"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def all_args_to_ivars(local_binding)
7
+ local_binding.local_variables.each do |lvar|
8
+ instance_variable_set("@#{lvar}", local_binding.local_variable_get(lvar))
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/argument_helpers/all_kwargs_to_ivars"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def all_kwargs_to_ivars(local_binding, namespace=:kwargs)
7
+ local_binding.local_variable_get(namespace).each do |name, value|
8
+ instance_variable_set "@#{name}", value
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/argument_helpers/args_to_ivars"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def args_to_ivars(local_binding, *local_vars)
7
+ local_vars.each do |lvar|
8
+ instance_variable_set("@#{lvar}", local_binding.local_variable_get(lvar))
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,5 @@
1
+ # require "eitil_core/arugment_helpers"
2
+
3
+ require "eitil_core/argument_helpers/all_args_to_ivars"
4
+ require "eitil_core/argument_helpers/args_to_ivars"
5
+ require "eitil_core/argument_helpers/all_kwargs_to_ivars"
@@ -0,0 +1,15 @@
1
+
2
+ # require "eitil_core/concerns/include_concerns_of"
3
+
4
+ class Module
5
+
6
+ def include_concerns_of(*directories, namespace: nil)
7
+ directories.map! { |dir| "#{namespace}::#{dir.to_s.camelcase}" }
8
+
9
+ directories.each do |dir|
10
+ konstants = dir.constantize.constants(false)
11
+ konstants.each { |kon| include(const_get "#{dir}::#{kon}") }
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/concerns/include_concerns_of"
@@ -0,0 +1,10 @@
1
+
2
+ # require "eitil_core/datetime/prettify"
3
+
4
+ class DateTime
5
+
6
+ def prettify
7
+ strftime "%Y-%m-%d.%H:%M:%S"
8
+ end
9
+
10
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/datetime/prettify"
@@ -0,0 +1,11 @@
1
+
2
+ # require "eitil_core/errors/raise_error"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def raise_error(_class_name, message = nil)
7
+ Object.const_set(_class_name, Class.new(StandardError)) unless Object.const_defined?(_class_name)
8
+ raise _class_name.constantize.new message
9
+ end
10
+
11
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/errors/raise_error"
@@ -0,0 +1,9 @@
1
+ class Float
2
+
3
+ # converts a float to an integer, only when no decimal values are lost.
4
+
5
+ def safe_to_i
6
+ self == self.to_i ? self.to_i : self
7
+ end
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/float/safe_to_i"
@@ -0,0 +1,17 @@
1
+
2
+ # require "eitil_core/hash/auto_dig"
3
+
4
+ class Hash
5
+
6
+ def auto_dig(_hash = self, _key)
7
+ return _hash[_key] if _hash.fetch(_key, false)
8
+
9
+ _hash.keys.each do |k|
10
+ answer = auto_dig(_hash[k], _key) if _hash[k].is_a? Hash
11
+ return answer if answer
12
+ end
13
+
14
+ nil
15
+ end
16
+
17
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/hash/auto_dig"
@@ -0,0 +1,32 @@
1
+
2
+ # require "eitil_core/lookups/all_methods"
3
+
4
+ require "awesome_print"
5
+
6
+ class Object
7
+
8
+ def all_methods(include_ancestors = true, grep: nil)
9
+
10
+ _introspection_methods = %i$
11
+ methods
12
+ singleton_methods
13
+ instance_methods
14
+ private_methods
15
+ public_methods
16
+ protected_methods
17
+ private_instance_methods
18
+ public_instance_methods
19
+ protected_instance_methods
20
+ $
21
+
22
+ _introspection_methods.map! do |_m|
23
+ _methods = safe_send _m, include_ancestors
24
+ _methods = grep ? _methods&.grep(grep) : _methods
25
+ { _m => _methods }
26
+ end
27
+
28
+ ap _introspection_methods.inject &:merge
29
+
30
+ end
31
+
32
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/lookups/all_methods"
@@ -0,0 +1,37 @@
1
+
2
+ require "rails"
3
+ require "eitil_core"
4
+
5
+ module EitilCore
6
+
7
+ class Railtie < Rails::Railtie
8
+
9
+ initializer "my_railtie.configure_rails_initialization", options: :after do |app|
10
+
11
+ # Dynamic dispatching after initialization of Rails classes.
12
+
13
+ # ApplicationRecord
14
+
15
+ if Object.const_defined?('EitilCore::ApplicationRecord::WhereLike')
16
+ ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::WhereLike)
17
+ end
18
+
19
+ if Object.const_defined?('EitilCore::ApplicationRecord::FindByLike')
20
+ ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::FindByLike)
21
+ end
22
+
23
+ if Object.const_defined?('EitilCore::ApplicationRecord::AllAssociations')
24
+ ::ApplicationRecord.send(:extend, EitilCore::ApplicationRecord::AllAssociations)
25
+ end
26
+
27
+ # ApplicationController
28
+
29
+ if Object.const_defined?('EitilCore::ApplicationController::SliceParams')
30
+ ::ActionController::API.send(:include, EitilCore::ApplicationController::SliceParams)
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/safe_executions/safe_call"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def safe_call(*args, return_value: nil, &block)
7
+ block.call self, *args
8
+ rescue
9
+ return_value
10
+ end
11
+
12
+ end
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/safe_executions/safe_send"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def safe_send(method, *args, return_value: nil)
7
+ self.send method, *args
8
+ rescue
9
+ return_value
10
+ end
11
+
12
+ end
@@ -0,0 +1,3 @@
1
+
2
+ require "eitil_core/safe_executions/safe_send"
3
+ require "eitil_core/safe_executions/safe_call"
@@ -0,0 +1,12 @@
1
+
2
+ # require "eitil_core/setters/set_ivars"
3
+
4
+ Kernel.module_eval do
5
+
6
+ def set_ivars(*ivars)
7
+ ivars.each do |ivar|
8
+ instance_variable_set("@#{ivar}", send("set_#{ivar}"))
9
+ end
10
+ end
11
+
12
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require "eitil_core/setters/set_ivars"