compressed_attributes 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/compressed_attributes.rb +5 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2999c795c0f05073f4a0a8f3cf10b786b5f8c3a8
4
- data.tar.gz: 59bc5073dad4244a3508ee694cfc02382365c812
3
+ metadata.gz: c8967cb02f5b381a7b4355e31e0c54628a6909af
4
+ data.tar.gz: 6f646be664738de0f079458a666ae46f8d785be2
5
5
  SHA512:
6
- metadata.gz: 2bbff82091af13420f16156831940d617c34cad43d11be3d44f86aad4b17d994e95d6b752694c49295a3b4f5a9c819a73ee9d6589d62f4b57ddf12481b44b2f0
7
- data.tar.gz: 7277f17d9ce518fcf0ec936b7eb7f9b016d4a411f17d35c9cbe68bb20f9c0cc7526a3eae4dcb2fb0f35526f22456d67e04441d140a29886c44bb3732ea7090d9
6
+ metadata.gz: 910971b082808bb37b93052969c246c6d73333e1cf780ff50871f69b82f674c430359cba82764ae6a5031ca655a8b0fe16976d2af5555dd6fa5a0aa5a340c297
7
+ data.tar.gz: 38b3459f682a72570fa0a933a406a4e2368c358ea9e9759219b6dea52b6fdc4d2dcad712279140fa8e29b06322ab26f6bbd974366605aa633100f2d8315a27ce
@@ -25,17 +25,18 @@ module CompressedAttributes
25
25
  compressed_attribute_names.each do |attribute_name|
26
26
  define_method("#{attribute_name}=".to_sym) do |new_value|
27
27
  if defined?(super)
28
- super(new_value.gzip)
28
+ super((new_value.nil? ? nil : new_value.gzip))
29
29
  else
30
- instance_variable_set("@#{attribute_name}".to_sym, new_value.gzip)
30
+ instance_variable_set("@#{attribute_name}".to_sym, (new_value.nil? ? nil : new_value.gzip))
31
31
  end
32
32
  end
33
33
 
34
34
  define_method(attribute_name.to_sym) do
35
+ #debugger
35
36
  if respond_to?(:read_attribute)
36
- read_attribute(attribute_name.to_sym).gunzip
37
+ return read_attribute(attribute_name.to_sym).nil? ? nil : read_attribute(attribute_name.to_sym).gunzip
37
38
  else
38
- instance_variable_get("@#{attribute_name}").gunzip
39
+ return instance_variable_get("@#{attribute_name}").nil? ? nil : instance_variable_get("@#{attribute_name}").gunzip
39
40
  end
40
41
  end
41
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: compressed_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Collier