Sha256: 98d6ad95adfb188aebd7f9f57915a48794b88b7bce1cea270e75b15516928e0d

Contents?: true

Size: 1.65 KB

Versions: 31

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true
require "lutaml/uml/classifier"

module Lutaml
  module Uml
    class DataType < Classifier
      include HasMembers

      attr_accessor :nested_classifier,
                    :is_abstract,
                    :type

      attr_reader :associations,
                  :attributes,
                  :members,
                  :modifier,
                  :constraints,
                  :operations,
                  :data_types

      def initialize(attributes = {})
        @nested_classifier = []
        @stereotype = []
        @generalization = []
        @is_abstract = false
        super
        @keyword = "dataType"
      end

      def modifier=(value)
        @modifier = value.to_s # TODO: Validate?
      end

      def attributes=(value)
        @attributes = value.to_a.map do |attr|
          TopElementAttribute.new(attr)
        end
      end

      def associations=(value)
        @associations = value.to_a.map do |attr|
          Association.new(attr.to_h.merge(owner_end: name))
        end
      end

      def constraints=(value)
        @constraints = value.to_a.map do |attr|
          Constraint.new(attr)
        end
      end

      def operations=(value)
        @operations = value.to_a.map do |attr|
          Operation.new(attr)
        end
      end

      def data_types=(value)
        @data_types = value.to_a.map do |attr|
          DataType.new(attr)
        end
      end

      def methods
        # @members&.select { |member| member.class == Method }
        []
      end

      def relationships
        # @members&.select { |member| member.class == ClassRelationship }
        []
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
lutaml-0.9.25 lib/lutaml/uml/data_type.rb
lutaml-0.9.24 lib/lutaml/uml/data_type.rb
lutaml-0.9.23 lib/lutaml/uml/data_type.rb
lutaml-0.9.22 lib/lutaml/uml/data_type.rb
lutaml-0.9.21 lib/lutaml/uml/data_type.rb
lutaml-0.9.20 lib/lutaml/uml/data_type.rb
lutaml-0.9.19 lib/lutaml/uml/data_type.rb
lutaml-0.9.18 lib/lutaml/uml/data_type.rb
lutaml-0.9.17 lib/lutaml/uml/data_type.rb
lutaml-0.9.16 lib/lutaml/uml/data_type.rb
lutaml-0.9.15 lib/lutaml/uml/data_type.rb
lutaml-0.9.14 lib/lutaml/uml/data_type.rb
lutaml-0.9.13 lib/lutaml/uml/data_type.rb
lutaml-0.9.12 lib/lutaml/uml/data_type.rb
lutaml-0.9.11 lib/lutaml/uml/data_type.rb
lutaml-0.9.10 lib/lutaml/uml/data_type.rb
lutaml-0.9.9 lib/lutaml/uml/data_type.rb
lutaml-0.9.8 lib/lutaml/uml/data_type.rb
lutaml-0.9.7 lib/lutaml/uml/data_type.rb
lutaml-0.9.6 lib/lutaml/uml/data_type.rb