Class: Moxml::Namespace
- Inherits:
-
Node
- Object
- Node
- Moxml::Namespace
show all
- Defined in:
- lib/moxml/namespace.rb
Constant Summary
Constants inherited
from Node
Moxml::Node::TYPES
Instance Attribute Summary
Attributes inherited from Node
#context, #native
Instance Method Summary
collapse
Methods inherited from Node
#[], #add_child, #add_next_sibling, #add_previous_sibling, #at_xpath, #children, #clone, #document, #each_node, #find, #find_all, #first_child, #has_children?, #initialize, #last_child, #namespace, #namespaces, #next_sibling, #parent, #previous_sibling, #remove, #replace, #text, #to_xml, wrap, #xpath
Methods included from XmlUtils
#encode_entities, #normalize_xml_value, #validate_comment_content, #validate_declaration_encoding, #validate_declaration_standalone, #validate_declaration_version, #validate_element_name, #validate_pi_target, #validate_prefix, #validate_uri
Constructor Details
This class inherits a constructor from Moxml::Node
Instance Method Details
#==(other) ⇒ Object
13
14
15
|
# File 'lib/moxml/namespace.rb', line 13
def ==(other)
other.is_a?(Namespace) && prefix == other.prefix && uri == other.uri
end
|
#default? ⇒ Boolean
25
26
27
|
# File 'lib/moxml/namespace.rb', line 25
def default?
prefix.nil? || prefix.to_s == "xmlns"
end
|
#namespace? ⇒ Boolean
29
30
31
|
# File 'lib/moxml/namespace.rb', line 29
def namespace?
true
end
|
#prefix ⇒ Object
5
6
7
|
# File 'lib/moxml/namespace.rb', line 5
def prefix
adapter.namespace_prefix(@native)
end
|
#to_s ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/moxml/namespace.rb', line 17
def to_s
if prefix && prefix != "xmlns"
%(xmlns:#{prefix}="#{uri}")
else
%(xmlns="#{uri}")
end
end
|
#uri ⇒ Object
9
10
11
|
# File 'lib/moxml/namespace.rb', line 9
def uri
adapter.namespace_uri(@native)
end
|