Sha256: f723dac98ea8c046472a3f88747e9d0bbdbe80234b2aee8b34280a2fd394a8e0

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

require "lutaml/uml/has_members"
require "lutaml/uml/classifier"
require "lutaml/uml/association"
require "lutaml/uml/top_element_attribute"

module Lutaml
  module Uml
    class Class < Classifier
      include HasMembers

      attr_accessor :nested_classifier,
                    :is_abstract,
                    :type

      attr_reader :associations,
                  :attributes,
                  :members,
                  :modifier

      def initialize(attributes = {})
        @nested_classifier = []
        @stereotype = []
        @generalization = []
        @is_abstract = false
        super
      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 methods
        # @members&.select { |member| member.class == Method }
        []
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lutaml-uml-0.3.0 lib/lutaml/uml/class.rb
lutaml-uml-0.2.12 lib/lutaml/uml/class.rb
lutaml-uml-0.2.10 lib/lutaml/uml/class.rb
lutaml-uml-0.2.9 lib/lutaml/uml/class.rb
lutaml-uml-0.2.8 lib/lutaml/uml/class.rb
lutaml-uml-0.2.3 lib/lutaml/uml/class.rb
lutaml-uml-0.2.2 lib/lutaml/uml/class.rb
lutaml-uml-0.2.1 lib/lutaml/uml/class.rb
lutaml-uml-0.2.0 lib/lutaml/uml/class.rb