Class: Taurus::XML::Namespace
- Inherits:
-
Object
- Object
- Taurus::XML::Namespace
- Defined in:
- lib/taurus/xml/namespace.rb
Overview
libtaurus's TaurusNamespace is const char* (the URI directly). The Ruby
Namespace wrapper holds (element, uri, optional prefix). When the prefix
isn't supplied (e.g. via Element#namespace), it can be derived by walking
the element's namespace declarations via taurus_element_namespace_decl_*.
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #document ⇒ Object
-
#initialize(element, href, prefix: :derive) ⇒ Namespace
constructor
A new instance of Namespace.
- #inspect ⇒ Object
Constructor Details
#initialize(element, href, prefix: :derive) ⇒ Namespace
Returns a new instance of Namespace.
11 12 13 14 15 |
# File 'lib/taurus/xml/namespace.rb', line 11 def initialize(element, href, prefix: :derive) @element = element @href = href @prefix = prefix == :derive ? derive_prefix : prefix end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
9 10 11 |
# File 'lib/taurus/xml/namespace.rb', line 9 def element @element end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
9 10 11 |
# File 'lib/taurus/xml/namespace.rb', line 9 def href @href end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
9 10 11 |
# File 'lib/taurus/xml/namespace.rb', line 9 def prefix @prefix end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 |
# File 'lib/taurus/xml/namespace.rb', line 21 def ==(other) other.is_a?(Taurus::XML::Namespace) && @href == other.href && @prefix == other.prefix end |
#document ⇒ Object
17 18 19 |
# File 'lib/taurus/xml/namespace.rb', line 17 def document @element&.document end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/taurus/xml/namespace.rb', line 26 def inspect "#<#{self.class.name} prefix=#{@prefix.inspect} href=#{@href.inspect}>" end |