Sha256: a9682882060de5cde227a404aa21b7209e5b9c2741b30c7a78b137f39aacaeb0

Contents?: true

Size: 828 Bytes

Versions: 15

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

15 entries across 15 versions & 1 rubygems

Version Path
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
lutaml-model-0.3.25 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.24 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.23 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.22 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.21 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.20 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.19 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.18 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.17 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.16 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.15 lib/lutaml/model/xml_adapter/xml_attribute.rb
lutaml-model-0.3.14 lib/lutaml/model/xml_adapter/xml_attribute.rb