rule_box 0.1.1 → 0.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 +4 -4
- data/lib/rule_box.rb +0 -2
- data/lib/rule_box/facade.rb +21 -10
- data/lib/rule_box/version.rb +1 -1
- data/rule_box.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f01478318a1639d5a1c20a7fd3f6e29cd5b3f65277017a40d272a0ea19ed426c
|
|
4
|
+
data.tar.gz: 7a443d2bb69cf7f80595e8be51459b3abe1590a0303b6582e055074ee345644e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7617bf7c3a6622ea03a7a3b2ad6b713691e90109ce41d1da40b2abe9308f89da9e0b31f744a49b8f1349d9196c579728b4768f9af374846e76db750cf42e201f
|
|
7
|
+
data.tar.gz: bf2dfe44c1ec7bcf2fc37227b2e4d5ae528cb457adbd770e7cd43413e09ccb0b67322e6f854a54a4f95ed16d9f89986bc37e5ed196f5417ece4a6e2326ee4fef
|
data/lib/rule_box.rb
CHANGED
data/lib/rule_box/facade.rb
CHANGED
|
@@ -42,6 +42,19 @@ class RuleBox::Facade
|
|
|
42
42
|
execute(:delete, model, args)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
def _current_class
|
|
46
|
+
@_current_class ||=
|
|
47
|
+
if model.nil?
|
|
48
|
+
nil
|
|
49
|
+
elsif model.is_a?(Class) || model.is_a?(Module)
|
|
50
|
+
model
|
|
51
|
+
elsif model.is_a?(Symbol) || model.is_a?(String)
|
|
52
|
+
Object.const_get RuleBox::Util.camelize(model.to_s)
|
|
53
|
+
else
|
|
54
|
+
Object.const_get model.class.name
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
45
58
|
def attributes
|
|
46
59
|
attrs = {}
|
|
47
60
|
%i[model status data bucket executed errors steps _current_method].each do |key|
|
|
@@ -77,7 +90,7 @@ class RuleBox::Facade
|
|
|
77
90
|
def respond_to_missing?(method, _include_private = false)
|
|
78
91
|
return false if @executed || method.to_s.end_with?('=')
|
|
79
92
|
|
|
80
|
-
|
|
93
|
+
super
|
|
81
94
|
end
|
|
82
95
|
|
|
83
96
|
def execute(method, model, **args)
|
|
@@ -93,7 +106,7 @@ class RuleBox::Facade
|
|
|
93
106
|
def pre_process(method, model)
|
|
94
107
|
@model = model
|
|
95
108
|
@_current_method = method
|
|
96
|
-
class_name =
|
|
109
|
+
class_name = _current_class
|
|
97
110
|
@errors = []
|
|
98
111
|
@steps = []
|
|
99
112
|
|
|
@@ -135,14 +148,12 @@ class RuleBox::Facade
|
|
|
135
148
|
steps << new_value
|
|
136
149
|
end
|
|
137
150
|
|
|
138
|
-
def
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Object.const_get model.class.name
|
|
145
|
-
end
|
|
151
|
+
def marshal_dump
|
|
152
|
+
instance_variables.map { |name| [name, instance_variable_get(name)] }.to_h
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def marshal_load(variables)
|
|
156
|
+
variables.each { |key, value| instance_variable_set(key, value) }
|
|
146
157
|
end
|
|
147
158
|
|
|
148
159
|
def keys
|
data/lib/rule_box/version.rb
CHANGED
data/rule_box.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
|
|
11
11
|
spec.summary = 'RuleBox'
|
|
12
12
|
spec.description = 'This gem is focused in giving a strong and concrete way to manage your business rules, mixing the best of both worlds in Facade and Strategy, bringing you a simplified way to apply these Design Patterns into your project.'
|
|
13
|
-
spec.homepage = 'https://github.com/ralphsbaesso'
|
|
13
|
+
spec.homepage = 'https://github.com/ralphsbaesso/rule_box'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
|
16
16
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rule_box
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ralph Baesso
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2020-10
|
|
12
|
+
date: 2020-12-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
14
|
description: This gem is focused in giving a strong and concrete way to manage your
|
|
15
15
|
business rules, mixing the best of both worlds in Facade and Strategy, bringing
|
|
@@ -43,11 +43,11 @@ files:
|
|
|
43
43
|
- lib/rule_box/util.rb
|
|
44
44
|
- lib/rule_box/version.rb
|
|
45
45
|
- rule_box.gemspec
|
|
46
|
-
homepage: https://github.com/ralphsbaesso
|
|
46
|
+
homepage: https://github.com/ralphsbaesso/rule_box
|
|
47
47
|
licenses:
|
|
48
48
|
- MIT
|
|
49
49
|
metadata:
|
|
50
|
-
homepage_uri: https://github.com/ralphsbaesso
|
|
50
|
+
homepage_uri: https://github.com/ralphsbaesso/rule_box
|
|
51
51
|
source_code_uri: https://github.com/ralphsbaesso/rule_box
|
|
52
52
|
post_install_message:
|
|
53
53
|
rdoc_options: []
|