Class: Moxml::Signature::ReferenceResolver
- Inherits:
-
Object
- Object
- Moxml::Signature::ReferenceResolver
- Defined in:
- lib/moxml/signature/reference_resolver.rb
Overview
Translates a Reference URI to a node (subtree) or octet string ready for the transform pipeline.
Only same-document references and bare-octet inputs are handled in this tier. External URI dereferencing is documented in TODO.complete/11.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(context:, document:) ⇒ ReferenceResolver
constructor
A new instance of ReferenceResolver.
-
#resolve(uri) ⇒ Object
Returns: - Moxml::Node for same-document references (subtree apex) - String (octets) for octet inputs.
Constructor Details
#initialize(context:, document:) ⇒ ReferenceResolver
Returns a new instance of ReferenceResolver.
14 15 16 17 |
# File 'lib/moxml/signature/reference_resolver.rb', line 14 def initialize(context:, document:) @context = context @document = document end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
12 13 14 |
# File 'lib/moxml/signature/reference_resolver.rb', line 12 def context @context end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
12 13 14 |
# File 'lib/moxml/signature/reference_resolver.rb', line 12 def document @document end |
Instance Method Details
#resolve(uri) ⇒ Object
Returns:
- Moxml::Node for same-document references (subtree apex)
- String (octets) for octet inputs
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/moxml/signature/reference_resolver.rb', line 22 def resolve(uri) case uri.to_s when "" document.root when /\A#/ resolve_fragment(uri[1..]) else uri.to_s end end |