Class: Lutaml::Model::SchemaLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/schema_location.rb

Constant Summary collapse

DEFAULT_NAMESPACE =
"http://www.w3.org/2001/XMLSchema-instance".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema_location:, prefix: "xsi", namespace: DEFAULT_NAMESPACE) ⇒ SchemaLocation



28
29
30
31
32
33
34
# File 'lib/lutaml/model/schema_location.rb', line 28

def initialize(schema_location:, prefix: "xsi",
namespace: DEFAULT_NAMESPACE)
  @original_schema_location = schema_location
  @schema_location = parsed_schema_locations(schema_location)
  @prefix = prefix
  @namespace = namespace
end

Instance Attribute Details

#namespaceObject (readonly)

Returns the value of attribute namespace.



26
27
28
# File 'lib/lutaml/model/schema_location.rb', line 26

def namespace
  @namespace
end

#prefixObject (readonly)

Returns the value of attribute prefix.



26
27
28
# File 'lib/lutaml/model/schema_location.rb', line 26

def prefix
  @prefix
end

#schema_locationObject (readonly)

Returns the value of attribute schema_location.



26
27
28
# File 'lib/lutaml/model/schema_location.rb', line 26

def schema_location
  @schema_location
end

Instance Method Details

#[](index) ⇒ Object



43
44
45
# File 'lib/lutaml/model/schema_location.rb', line 43

def [](index)
  @schema_location[index]
end

#sizeObject



47
48
49
# File 'lib/lutaml/model/schema_location.rb', line 47

def size
  @schema_location.size
end

#to_xml_attributesObject



36
37
38
39
40
41
# File 'lib/lutaml/model/schema_location.rb', line 36

def to_xml_attributes
  {
    "xmlns:#{prefix}" => namespace,
    "#{prefix}:schemaLocation" => schema_location.map(&:to_xml_attribute).join(" "),
  }
end