Class: Lutaml::Xsd::PackageSource
- Inherits:
-
Object
- Object
- Lutaml::Xsd::PackageSource
- Defined in:
- lib/lutaml/xsd/package_source.rb
Overview
Represents a loaded package as a source of schemas/types Not serializable - created at runtime from BasePackageConfig
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#package_path ⇒ Object
readonly
Returns the value of attribute package_path.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#conflict_resolution ⇒ String
Get conflict resolution strategy.
-
#include_schema?(schema_path) ⇒ Boolean
Check if a schema should be included.
-
#initialize(package_path:, config:, repository:) ⇒ PackageSource
constructor
A new instance of PackageSource.
-
#inspect ⇒ String
Detailed inspection.
-
#namespace_remapping ⇒ Array<NamespaceUriRemapping>
Get namespace remapping rules.
-
#namespaces ⇒ Array<String>
Get all namespaces in this package.
-
#priority ⇒ Integer
Get priority for conflict resolution.
-
#schema_files ⇒ Array<String>
Get all schema files in this package.
-
#to_s ⇒ String
String representation.
-
#types_in_namespace(namespace_uri) ⇒ Array<String>
Get all type names in a specific namespace.
Constructor Details
#initialize(package_path:, config:, repository:) ⇒ PackageSource
Returns a new instance of PackageSource.
15 16 17 18 19 |
# File 'lib/lutaml/xsd/package_source.rb', line 15 def initialize(package_path:, config:, repository:) @package_path = package_path @config = config @repository = repository end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/lutaml/xsd/package_source.rb', line 10 def config @config end |
#package_path ⇒ Object (readonly)
Returns the value of attribute package_path.
10 11 12 |
# File 'lib/lutaml/xsd/package_source.rb', line 10 def package_path @package_path end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
10 11 12 |
# File 'lib/lutaml/xsd/package_source.rb', line 10 def repository @repository end |
Instance Method Details
#conflict_resolution ⇒ String
Get conflict resolution strategy
29 30 31 |
# File 'lib/lutaml/xsd/package_source.rb', line 29 def conflict_resolution @config.conflict_resolution end |
#include_schema?(schema_path) ⇒ Boolean
Check if a schema should be included
61 62 63 |
# File 'lib/lutaml/xsd/package_source.rb', line 61 def include_schema?(schema_path) @config.include_schema?(schema_path) end |
#inspect ⇒ String
Detailed inspection
73 74 75 76 77 78 79 |
# File 'lib/lutaml/xsd/package_source.rb', line 73 def inspect "#<PackageSource:#{object_id} " \ "path=#{@package_path.inspect} " \ "priority=#{priority} " \ "strategy=#{conflict_resolution} " \ "namespaces=#{namespaces.size}>" end |
#namespace_remapping ⇒ Array<NamespaceUriRemapping>
Get namespace remapping rules
54 55 56 |
# File 'lib/lutaml/xsd/package_source.rb', line 54 def namespace_remapping @config.namespace_remapping || [] end |
#namespaces ⇒ Array<String>
Get all namespaces in this package
35 36 37 |
# File 'lib/lutaml/xsd/package_source.rb', line 35 def namespaces @repository.all_namespaces end |
#priority ⇒ Integer
Get priority for conflict resolution
23 24 25 |
# File 'lib/lutaml/xsd/package_source.rb', line 23 def priority @config.priority end |
#schema_files ⇒ Array<String>
Get all schema files in this package
48 49 50 |
# File 'lib/lutaml/xsd/package_source.rb', line 48 def schema_files @repository.files || [] end |
#to_s ⇒ String
String representation
67 68 69 |
# File 'lib/lutaml/xsd/package_source.rb', line 67 def to_s "PackageSource(#{File.basename(@package_path)}, priority=#{priority})" end |
#types_in_namespace(namespace_uri) ⇒ Array<String>
Get all type names in a specific namespace
42 43 44 |
# File 'lib/lutaml/xsd/package_source.rb', line 42 def types_in_namespace(namespace_uri) @repository.all_type_names(namespace: namespace_uri) end |