Module: REXML::Namespace
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
XMLTokens
|
|
Defined in: | lib/rexml/namespace.rb |
Overview
Adds named attributes to an object.
Constant Summary
-
NAMESPLIT =
# File 'lib/rexml/namespace.rb', line 13/^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
XMLTokens
- Included
NAME, NAMECHAR, NAME_CHAR, NAME_START_CHAR, NAME_STR, NCNAME_STR, NMTOKEN, NMTOKENS, REFERENCE
Instance Attribute Summary
-
#expanded_name
readonly
The name of the object, valid if set.
-
#local_name
readonly
Alias for #name.
-
#name
(also: #local_name)
rw
The name of the object, valid if set.
-
#name=(name)
rw
Sets the name and the expanded name.
-
#prefix
rw
The expanded name of the object, valid if name is set.
Instance Method Summary
-
#fully_expanded_name
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 (readonly)
The name of the object, valid if set
# File 'lib/rexml/namespace.rb', line 9
attr_reader :name, :
#local_name (readonly)
Alias for #name.
# File 'lib/rexml/namespace.rb', line 49
alias :local_name :name
#name (rw) Also known as: #local_name
The name of the object, valid if set
# File 'lib/rexml/namespace.rb', line 9
attr_reader :name, :
#name=(name) (rw)
Sets the name and the expanded name
# File 'lib/rexml/namespace.rb', line 16
def name=( name ) @expanded_name = name case name when NAMESPLIT if $1 @prefix = $1 else @prefix = "" @namespace = "" end @name = $2 when "" @prefix = nil @namespace = nil @name = nil else = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: " += "<#{name.inspect}>" raise ArgumentError, end end
#prefix (rw)
The expanded name of the object, valid if name is set
# File 'lib/rexml/namespace.rb', line 11
attr_accessor :prefix
Instance Method Details
#fully_expanded_name
Fully expand the name, even if the prefix wasn’t specified in the source file.
# File 'lib/rexml/namespace.rb', line 53
def ns = prefix return "#{ns}:#@name" if ns.size > 0 return @name end
#has_name?(other, ns = nil) ⇒ Boolean
Compares names optionally WITH namespaces