Module: REXML::Namespace

Includes:
XMLTokens
Defined in:
lib/compat/opal/rexml/namespace.rb

Constant Summary collapse

NAME_WITHOUT_NAMESPACE =
/^#{NCNAME_STR}$/
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

Instance Method Summary collapse

Instance Attribute Details

#expanded_nameObject (readonly)

Returns the value of attribute expanded_name.



7
8
9
# File 'lib/compat/opal/rexml/namespace.rb', line 7

def expanded_name
  @expanded_name
end

#nameObject Also known as: local_name

Returns the value of attribute name.



7
8
9
# File 'lib/compat/opal/rexml/namespace.rb', line 7

def name
  @name
end

#prefixObject

Returns the value of attribute prefix.



8
9
10
# File 'lib/compat/opal/rexml/namespace.rb', line 8

def prefix
  @prefix
end

Instance Method Details

#fully_expanded_nameObject



50
51
52
53
54
# File 'lib/compat/opal/rexml/namespace.rb', line 50

def fully_expanded_name
  ns = prefix
  return "#{ns}:#@name" if ns.size > 0
  @name
end

#has_name?(other, ns = nil) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
46
# File 'lib/compat/opal/rexml/namespace.rb', line 38

def has_name?( other, ns=nil )
  if ns
    namespace() == ns and name() == other
  elsif other.include? ":"
    fully_expanded_name == other
  else
    name == other
  end
end