Sha256: 149363d9cf93ffd322eb906f3b5d153bfc622cd584d6a2691b8493211d693463

Contents?: true

Size: 1.41 KB

Versions: 38

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module Lutaml
  module Uml
    class TopElement
      include HasAttributes

      attr_accessor :name,
                    :definition,
                    :xmi_id,
                    :xmi_uuid,
                    :namespace,
                    :keyword,
                    :stereotype,
                    :href,
                    :visibility,
                    :comments

      # rubocop:disable Rails/ActiveRecordAliases
      def initialize(attributes = {})
        @visibility = "public"
        @name = attributes["name"]
        update_attributes(attributes)
      end
      # rubocop:enable Rails/ActiveRecordAliases

      def full_name
        if name == nil
          return nil
        end

        the_name = name
        next_namespace = namespace

        while !next_namespace.nil?
          the_name = if !next_namespace.name.nil?
                       next_namespace.name + "::" + the_name
                     else
                       "::" + the_name
                     end
          next_namespace = next_namespace.namespace
        end

        the_name
      end

      def definition=(value)
        @definition = value
                        .to_s
                        .gsub(/\\}/, '}')
                        .gsub(/\\{/, '{')
                        .split("\n")
                        .map(&:strip)
                        .join("\n")
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
lutaml-0.9.5 lib/lutaml/uml/top_element.rb
lutaml-0.9.4 lib/lutaml/uml/top_element.rb
lutaml-0.9.3 lib/lutaml/uml/top_element.rb
lutaml-0.9.2 lib/lutaml/uml/top_element.rb
lutaml-0.9.1 lib/lutaml/uml/top_element.rb
lutaml-0.9.0 lib/lutaml/uml/top_element.rb
lutaml-0.8.1 lib/lutaml/uml/top_element.rb
lutaml-0.8.0 lib/lutaml/uml/top_element.rb
lutaml-uml-0.4.3 lib/lutaml/uml/top_element.rb
lutaml-uml-0.4.1 lib/lutaml/uml/top_element.rb
lutaml-uml-0.4.0 lib/lutaml/uml/top_element.rb
lutaml-uml-0.3.2 lib/lutaml/uml/top_element.rb
lutaml-uml-0.3.1 lib/lutaml/uml/top_element.rb
lutaml-uml-0.3.0 lib/lutaml/uml/top_element.rb
lutaml-uml-0.2.12 lib/lutaml/uml/top_element.rb
lutaml-uml-0.2.10 lib/lutaml/uml/top_element.rb
lutaml-uml-0.2.9 lib/lutaml/uml/top_element.rb
lutaml-uml-0.2.8 lib/lutaml/uml/top_element.rb