Sha256: d3870f19cac055991797877573d22312bce5edde88eaabbaa9740b36f6a9c9ce

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

module Lutaml
  module XMI
    class PackageDrop < Liquid::Drop
      def initialize(model) # rubocop:disable Lint/MissingSuper
        @model = model
        @children_packages ||= packages.map do |pkg|
          [pkg, pkg.packages, pkg.packages.map(&:children_packages)]
        end.flatten.uniq
      end

      def xmi_id
        @model[:xmi_id]
      end

      def name
        @model[:name]
      end

      def klasses
        @model[:classes].map do |klass|
          ::Lutaml::XMI::KlassDrop.new(klass)
        end
      end
      alias classes klasses

      def enums
        @model[:enums].map do |enum|
          ::Lutaml::XMI::EnumDrop.new(enum)
        end
      end

      def data_types
        @model[:data_types].map do |data_type|
          ::Lutaml::XMI::DataTypeDrop.new(data_type)
        end
      end

      def diagrams
        @model[:diagrams].map do |diagram|
          ::Lutaml::XMI::DiagramDrop.new(diagram)
        end
      end

      def packages
        @model[:packages].map do |package|
          ::Lutaml::XMI::PackageDrop.new(package)
        end
      end

      def children_packages
        @children_packages
      end

      def definition
        @model[:definition]
      end

      def stereotype
        @model[:stereotype]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lutaml-0.9.17 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.16 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.15 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.14 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.13 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.12 lib/lutaml/xmi/liquid_drops/package_drop.rb
lutaml-0.9.11 lib/lutaml/xmi/liquid_drops/package_drop.rb