Class: Lutaml::Xml::Location
- Inherits:
-
Object
- Object
- Lutaml::Xml::Location
- Defined in:
- lib/lutaml/xml/schema_location.rb
Overview
Location represents a single namespace-to-schema-location mapping Used within xsi:schemaLocation attribute values
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#namespace_class ⇒ Object
readonly
Returns the value of attribute namespace_class.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(namespace_class:, location:) ⇒ Location
constructor
A new instance of Location.
-
#namespace ⇒ String
Returns the namespace URI from the XmlNamespace class.
-
#to_xml_attribute ⇒ String
Format for xsi:schemaLocation attribute value (space-separated pair).
Constructor Details
#initialize(namespace_class:, location:) ⇒ Location
Returns a new instance of Location.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lutaml/xml/schema_location.rb', line 22 def initialize(namespace_class:, location:) unless namespace_class.is_a?(Class) && namespace_class < Lutaml::Xml::Namespace raise ArgumentError, "namespace_class must be an Xml::Namespace subclass, got #{namespace_class.class}. " \ "String namespace URIs are no longer supported." end @namespace_class = namespace_class @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
18 19 20 |
# File 'lib/lutaml/xml/schema_location.rb', line 18 def location @location end |
#namespace_class ⇒ Object (readonly)
Returns the value of attribute namespace_class.
18 19 20 |
# File 'lib/lutaml/xml/schema_location.rb', line 18 def namespace_class @namespace_class end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
45 46 47 48 49 |
# File 'lib/lutaml/xml/schema_location.rb', line 45 def eql?(other) other.class == self.class && namespace_class == other.namespace_class && location == other.location end |
#hash ⇒ Object
52 53 54 |
# File 'lib/lutaml/xml/schema_location.rb', line 52 def hash [namespace_class, location].hash end |
#namespace ⇒ String
Returns the namespace URI from the XmlNamespace class
35 36 37 |
# File 'lib/lutaml/xml/schema_location.rb', line 35 def namespace namespace_class.uri end |
#to_xml_attribute ⇒ String
Format for xsi:schemaLocation attribute value (space-separated pair)
41 42 43 |
# File 'lib/lutaml/xml/schema_location.rb', line 41 def to_xml_attribute "#{namespace} #{location}".strip end |