Sha256: d0f2a144a131c0568626230385ebd938fa2d6bd7e7f3db1f8a90bd582b4e9e09
Contents?: true
Size: 884 Bytes
Versions: 31
Compression:
Stored size: 884 Bytes
Contents
# frozen_string_literal: true module DrawioDsl module Schema class NodeList attr_reader :nodes def initialize @nodes = [] end def add(parent, node) node.parent = parent @nodes << node end def all @nodes end def shapes @nodes.select { |node| node.is_a?(DrawioDsl::Schema::Shape) } end def layouts @nodes.select { |node| node.is_a?(DrawioDsl::Schema::Layout) } end def length @nodes.length end def empty? @nodes.empty? end def any? @nodes.any? end def first @nodes.first end def as_xml(xml) nodes.each do |node| node.as_xml(xml) if node.respond_to?(:as_xml) end end def to_h @nodes.map(&:to_h) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems