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.25 lib/lutaml/uml/top_element.rb
lutaml-0.9.24 lib/lutaml/uml/top_element.rb
lutaml-0.9.23 lib/lutaml/uml/top_element.rb
lutaml-0.9.22 lib/lutaml/uml/top_element.rb
lutaml-0.9.21 lib/lutaml/uml/top_element.rb
lutaml-0.9.20 lib/lutaml/uml/top_element.rb
lutaml-0.9.19 lib/lutaml/uml/top_element.rb
lutaml-0.9.18 lib/lutaml/uml/top_element.rb
lutaml-0.9.17 lib/lutaml/uml/top_element.rb
lutaml-0.9.16 lib/lutaml/uml/top_element.rb
lutaml-0.9.15 lib/lutaml/uml/top_element.rb
lutaml-0.9.14 lib/lutaml/uml/top_element.rb
lutaml-0.9.13 lib/lutaml/uml/top_element.rb
lutaml-0.9.12 lib/lutaml/uml/top_element.rb
lutaml-0.9.11 lib/lutaml/uml/top_element.rb
lutaml-0.9.10 lib/lutaml/uml/top_element.rb
lutaml-0.9.9 lib/lutaml/uml/top_element.rb
lutaml-0.9.8 lib/lutaml/uml/top_element.rb
lutaml-0.9.7 lib/lutaml/uml/top_element.rb
lutaml-0.9.6 lib/lutaml/uml/top_element.rb