Module: Redwood::SerializeLabelsNicely
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
- #after_unmarshal! ⇒ Object
-
#before_marshal ⇒ Object
can return an object.
Instance Method Details
#after_unmarshal! ⇒ Object
164 165 166 |
# File 'lib/sup/source.rb', line 164 def after_unmarshal! @labels = Set.new(@labels.to_a.map { |s| s.to_sym }) end |
#before_marshal ⇒ Object
can return an object
158 159 160 161 162 |
# File 'lib/sup/source.rb', line 158 def before_marshal # can return an object c = clone c.instance_eval { @labels = (@labels.to_a.map { |l| l.to_s }).sort } c end |