This fixes some bugs where sources have an "inbox" label specified, which
was previously treated as different from the auto-applied :inbox label, etc.
@snippet = opts[:snippet]
@snippet_contains_encrypted_content = false
@have_snippet = !(opts[:snippet].nil? || opts[:snippet].empty?)
- @labels = [] + (opts[:labels] || [])
+ @labels = (opts[:labels] || []).to_set_of_symbols
@dirty = false
@encrypted = false
@chunks = nil
def has_label? t; @labels.member? t; end
def add_label t
return if @labels.member? t
- @labels.push t
+ @labels = (@labels + [t]).to_set_of_symbols
@dirty = true
end
def remove_label t
end
def labels= l
- @labels = l
+ @labels = l.to_set_of_symbols
@dirty = true
end
def last= e; self[-1] = e end
def nonempty?; !empty? end
+
+ def to_set_of_symbols
+ map { |x| x.is_a?(Symbol) ? x : x.intern }.uniq
+ end
end
class Time