Class: Archimate::FileFormats::Serializer::NamedCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/archimate/file_formats/serializer/named_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, collection) ⇒ NamedCollection

Returns a new instance of NamedCollection.



7
8
9
10
# File 'lib/archimate/file_formats/serializer/named_collection.rb', line 7

def initialize(name, collection)
  @name = name
  @collection = collection
end

Instance Method Details

#serialize(xml, &block) ⇒ Object



12
13
14
15
16
17
# File 'lib/archimate/file_formats/serializer/named_collection.rb', line 12

def serialize(xml, &block)
  return unless @collection&.size&.positive?
  xml.send(@name) do
    block.call(xml, @collection)
  end
end