Class: Trello::Schema::Serializer::Labels

Inherits:
Object
  • Object
show all
Defined in:
lib/trello/schema/serializer/labels.rb

Class Method Summary collapse

Class Method Details

.deserialize(labels, default) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/trello/schema/serializer/labels.rb', line 10

def deserialize(labels, default)
  return default unless labels

  labels.map do |label|
    next label if label.is_a?(Trello::Label)

    Trello::Label.new(label)
  end
end

.serialize(labels) ⇒ Object



6
7
8
# File 'lib/trello/schema/serializer/labels.rb', line 6

def serialize(labels)
  labels.map(&:id)
end