Class: ARSerializeHelpers::Gzip

Inherits:
Object
  • Object
show all
Defined in:
lib/ar-serialize-helpers/gzip.rb

Instance Method Summary collapse

Instance Method Details

#dump(obj) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/ar-serialize-helpers/gzip.rb', line 6

def dump obj
  if obj.is_a?(String)
    ActiveSupport::Gzip.compress(obj) if obj != nil
  else
    obj
  end
end

#load(text) ⇒ Object



14
15
16
# File 'lib/ar-serialize-helpers/gzip.rb', line 14

def load text
  ActiveSupport::Gzip.decompress(text) if text
end