Module: Redwood::SerializeLabelsNicely

Included in:
MBox, Maildir
Defined in:
lib/sup/source.rb

Overview

if you have a @labels instance variable, include this to serialize them nicely as an array, rather than as a nasty set.

Instance Method Summary collapse

Instance Method Details

#after_unmarshal!Object



162
163
164
# File 'lib/sup/source.rb', line 162

def after_unmarshal!
  @labels = Set.new(@labels.map { |s| s.to_sym })
end

#before_marshalObject

can return an object



156
157
158
159
160
# File 'lib/sup/source.rb', line 156

def before_marshal # can return an object
  c = clone
  c.instance_eval { @labels = (@labels.to_a.map { |l| l.to_s }).sort }
  c
end