tdc 0.4.1 → 0.4.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/CHANGELOG.md +4 -0
- data/lib/tdc/extended_attributes/default_interpreter.rb +15 -11
- data/lib/tdc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83b4405ab9ec996fbab35d7228931e03d5bf18966df916b631d36d6aecca4393
|
4
|
+
data.tar.gz: 942728ff3d354bb5dc516c777606766b798ae218b4fd85ec4823cfad7e9d1875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a783d54d2a3af00fcd0d8366b1a55190503fda3350308179f5eb778f2fab6f3601b7c6eded92bd27a123a39303160ffa19381902228e8e11ab5f4213deda20c
|
7
|
+
data.tar.gz: 5cc30405e4369c739e5a77370bf663d0813a2a72e2bdbaa7791bd8c1f966c5337c477689c4f968b82d20ee41bc3d22f94baa0731fb0d38948f6001137d4f56c6
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,7 @@ module Tdc
|
|
7
7
|
#
|
8
8
|
class DefaultInterpreter < Tdc::ExtendedAttributes::InterpreterBase
|
9
9
|
def interpret(instance_definition)
|
10
|
-
extended_attribute_definitions =
|
10
|
+
extended_attribute_definitions = keep_extended_attributes(instance_definition)
|
11
11
|
|
12
12
|
extended_attribute_definitions.each do |extended_attribute_key, extended_attribute_value|
|
13
13
|
# Remove the extended attribute.
|
@@ -20,23 +20,27 @@ module Tdc
|
|
20
20
|
end
|
21
21
|
|
22
22
|
concerning :HookMethods do
|
23
|
-
def convert_to_standard_attribute(extended_attribute_key)
|
24
|
-
extended_attribute_key.gsub(/_(at|date|on)x$/, "_\\1")
|
25
|
-
end
|
26
|
-
|
27
23
|
def extended_attribute_context
|
28
24
|
Time.zone
|
29
25
|
end
|
30
|
-
|
31
|
-
def extended_attribute?(extended_attribute_key)
|
32
|
-
/_(at|date|on)x$/ =~ extended_attribute_key
|
33
|
-
end
|
34
26
|
end
|
35
27
|
|
36
28
|
private
|
37
29
|
|
38
|
-
|
39
|
-
|
30
|
+
EXTENDED_ATTRIBUTE_SUFFIX = "_xa"
|
31
|
+
|
32
|
+
def convert_to_standard_attribute(extended_attribute_key)
|
33
|
+
extended_attribute_key.delete_suffix(EXTENDED_ATTRIBUTE_SUFFIX)
|
34
|
+
end
|
35
|
+
|
36
|
+
def extended_attribute?(extended_attribute_key)
|
37
|
+
extended_attribute_key.end_with?(EXTENDED_ATTRIBUTE_SUFFIX)
|
38
|
+
end
|
39
|
+
|
40
|
+
def keep_extended_attributes(instance_definition)
|
41
|
+
instance_definition.select do |extended_attribute_key, _|
|
42
|
+
extended_attribute?(extended_attribute_key)
|
43
|
+
end
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
data/lib/tdc/version.rb
CHANGED