Module: REXML::Namespace
Overview
Adds named attributes to an object.
Constant Summary collapse
- NAMESPLIT =
/^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
Constants included from XMLTokens
XMLTokens::NAME, XMLTokens::NAMECHAR, XMLTokens::NAME_CHAR, XMLTokens::NAME_START_CHAR, XMLTokens::NAME_STR, XMLTokens::NCNAME_STR, XMLTokens::NMTOKEN, XMLTokens::NMTOKENS, XMLTokens::REFERENCE
Instance Attribute Summary collapse
-
#expanded_name ⇒ Object
readonly
The name of the object, valid if set.
-
#name ⇒ Object
(also: #local_name)
The name of the object, valid if set.
-
#prefix ⇒ Object
The expanded name of the object, valid if name is set.
Instance Method Summary collapse
-
#fully_expanded_name ⇒ Object
Fully expand the name, even if the prefix wasn’t specified in the source file.
-
#has_name?(other, ns = nil) ⇒ Boolean
Compares names optionally WITH namespaces.
Instance Attribute Details
#expanded_name ⇒ Object (readonly)
The name of the object, valid if set
8 9 10 |
# File 'lib/rexml/namespace.rb', line 8 def @expanded_name end |
#name ⇒ Object Also known as: local_name
The name of the object, valid if set
8 9 10 |
# File 'lib/rexml/namespace.rb', line 8 def name @name end |
#prefix ⇒ Object
The expanded name of the object, valid if name is set
10 11 12 |
# File 'lib/rexml/namespace.rb', line 10 def prefix @prefix end |
Instance Method Details
#fully_expanded_name ⇒ Object
Fully expand the name, even if the prefix wasn’t specified in the source file.
42 43 44 45 46 |
# File 'lib/rexml/namespace.rb', line 42 def ns = prefix return "#{ns}:#@name" if ns.size > 0 return @name end |
#has_name?(other, ns = nil) ⇒ Boolean
Compares names optionally WITH namespaces
28 29 30 31 32 33 34 35 36 |
# File 'lib/rexml/namespace.rb', line 28 def has_name?( other, ns=nil ) if ns return (namespace() == ns and name() == other) elsif other.include? ":" return == other else return name == other end end |