Class: Lutaml::Model::Xml::XmlNamespace
- Inherits:
-
Object
- Object
- Lutaml::Model::Xml::XmlNamespace
- Defined in:
- lib/lutaml/model/xml/xml_namespace.rb
Instance Attribute Summary collapse
-
#prefix ⇒ String
private
Return prefix.
-
#uri ⇒ String
private
Return name.
Instance Method Summary collapse
- #attr_name ⇒ Object
-
#initialize(uri = nil, prefix = nil) ⇒ XmlNamespace
constructor
private
Initialize instance.
- #normalize_prefix(prefix) ⇒ Object
Constructor Details
#initialize(uri = nil, prefix = nil) ⇒ XmlNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize instance
27 28 29 30 |
# File 'lib/lutaml/model/xml/xml_namespace.rb', line 27 def initialize(uri = nil, prefix = nil) @uri = uri @prefix = normalize_prefix(prefix) end |
Instance Attribute Details
#prefix ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return prefix
19 20 21 |
# File 'lib/lutaml/model/xml/xml_namespace.rb', line 19 def prefix @prefix end |
#uri ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return name
12 13 14 |
# File 'lib/lutaml/model/xml/xml_namespace.rb', line 12 def uri @uri end |
Instance Method Details
#attr_name ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/lutaml/model/xml/xml_namespace.rb', line 39 def attr_name if Utils.present?(prefix) "xmlns:#{prefix}" else "xmlns" end end |
#normalize_prefix(prefix) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/lutaml/model/xml/xml_namespace.rb', line 32 def normalize_prefix(prefix) normalized_prefix = prefix.to_s.gsub(/xmlns:?/, "") return if normalized_prefix.empty? normalized_prefix end |