Sha256: a9682882060de5cde227a404aa21b7209e5b9c2741b30c7a78b137f39aacaeb0

Contents?: true

Size: 828 Bytes

Versions: 32

Compression:

Stored size: 828 Bytes

Contents

# frozen_string_literal: true

module Lutaml
  module Model
    module XmlAdapter
      # Represents an XML attribute
      class XmlAttribute
        attr_reader :name, :value, :namespace, :namespace_prefix

        def initialize(name, value, namespace: nil, namespace_prefix: nil)
          @name = name
          @value = value
          @namespace = namespace
          @namespace_prefix = namespace_prefix
        end

        def unprefixed_name
          if namespace_prefix
            name.split(":").last
          else
            name
          end
        end

        def namespaced_name
          if unprefixed_name == "lang"
            name
          elsif namespace
            "#{namespace}:#{unprefixed_name}"
          else
            unprefixed_name
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
lutaml-model-0.7.0 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.7 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.6 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.5 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.4 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.3 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.2 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.1 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.6.0 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.5.4 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.5.3 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.5.2 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.5.1 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.5.0 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.4.0 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.30 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.29 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.28 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.27 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.26 lib/lutaml/model/xml_adapter/xml_attribute.rb