compressed_attributes 0.1.2 → 0.2.0
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/compressed_attributes.rb +8 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d55fee99df150df2b7bea26132bb7adc664b2c0c
|
4
|
+
data.tar.gz: 458b24ae1139c2d3edfcaf6621da5c33a6441e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6cb191f74db48507cc724d71a86e924fcbe232767609bdc5fd7c5adb43628b901ab0a42852467ca6c7f92ef1e75e526fd51632ad8d7a8fc22560bda6b031eb0
|
7
|
+
data.tar.gz: 7d2b5a76ec618dad70821f39aca2d2203871cebef0195963a87ed8d732d7c1588b309d764a331d3f561660dd6162172ffcf98b2f959188c15253f86f9d1dbfd7
|
@@ -24,19 +24,22 @@ module CompressedAttributes
|
|
24
24
|
|
25
25
|
compressed_attribute_names.each do |attribute_name|
|
26
26
|
define_method("#{attribute_name}=".to_sym) do |new_value|
|
27
|
+
new_value = new_value.gzip if new_value!=nil && new_value.valid_encoding?
|
28
|
+
|
27
29
|
if defined?(super)
|
28
|
-
super(
|
30
|
+
super(new_value)
|
29
31
|
else
|
30
|
-
instance_variable_set("@#{attribute_name}".to_sym,
|
32
|
+
instance_variable_set("@#{attribute_name}".to_sym, new_value)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
34
36
|
define_method(attribute_name.to_sym) do
|
35
|
-
#debugger
|
36
37
|
if respond_to?(:read_attribute)
|
37
|
-
return
|
38
|
+
return nil if read_attribute(attribute_name.to_sym).nil?
|
39
|
+
read_attribute(attribute_name.to_sym).gunzip #rescue nil
|
38
40
|
else
|
39
|
-
return
|
41
|
+
return nil if instance_variable_get("@#{attribute_name}".to_sym).nil?
|
42
|
+
instance_variable_get("@#{attribute_name}").gunzip #rescue nil
|
40
43
|
end
|
41
44
|
end
|
42
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compressed_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Collier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gzip
|