tunable 0.1.0 → 0.1.1
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/tunable/model.rb +3 -1
- data/lib/tunable/normalizer.rb +4 -4
- data/lib/tunable/version.rb +1 -1
- 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: 5f3e0b03aefc94040217c4c2b0b4e58da393015ea4296dee04f2efc1e13de95c
|
4
|
+
data.tar.gz: 4a5d9dd43998e77b677cb5c652366e6ad3fbaab97a0e458358c2f912b1ef9ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10ebb099faa035fe760a6b6c42acaabdb603513378bd4bd24c586cf1c3c872a3fa0597b2863760f715da6f8754b2671ed86a78fdf33f4f0ae6008366ddf060e
|
7
|
+
data.tar.gz: '019c5b00133fcad806079acd55c5152c599e70bda44474fcb904769399e1d54d8e8ee9403970a7b026510890f071973975757c7d9e416aabadc0922075d880da'
|
data/lib/tunable/model.rb
CHANGED
@@ -264,9 +264,11 @@ module Tunable
|
|
264
264
|
|
265
265
|
modified_settings.each do |context, fields|
|
266
266
|
fields.each do |key, value|
|
267
|
+
|
267
268
|
# even though we do normalize on the setters, not all settings are
|
268
269
|
# main settings, so we need to make sure we normalize here again
|
269
|
-
|
270
|
+
default = self.class.default_settings(context)[key.to_sym]
|
271
|
+
normalized_value = Tunable.normalize_value(value, default.nil? ? nil : default.class)
|
270
272
|
|
271
273
|
# class.base_class returns name of parent class for STI models
|
272
274
|
new_settings << [context.to_s, key.to_s, normalized_value, self.id, self.class.base_class.name]
|
data/lib/tunable/normalizer.rb
CHANGED
@@ -6,10 +6,10 @@ module Tunable
|
|
6
6
|
FALSIES = ['false', 'f', 'off', 'no', 'n'].freeze
|
7
7
|
|
8
8
|
def normalize_value(val, type = nil)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
if type && [TrueClass, FalseClass].include?(type)
|
10
|
+
return false if val.to_s == '0'
|
11
|
+
return true if val.to_s == '1'
|
12
|
+
end
|
13
13
|
|
14
14
|
return true if TRUTHIES.include?(val.to_s)
|
15
15
|
return false if FALSIES.include?(val.to_s)
|
data/lib/tunable/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tunable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|