Class: XML::Smart::Dom::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/smart_domnamespace.rb

Instance Method Summary collapse

Constructor Details

#initialize(ns) ⇒ Namespace

Returns a new instance of Namespace.



6
7
8
# File 'lib/xml/smart_domnamespace.rb', line 6

def initialize(ns)
  @ns = ns
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
27
# File 'lib/xml/smart_domnamespace.rb', line 23

def ==(other)
  return false unless other
  return false unless other.respond_to?(:to_s)
  to_s == other.to_s
end

#===(cls) ⇒ Object



10
# File 'lib/xml/smart_domnamespace.rb', line 10

def ===(cls); self.is_a? cls; end

#hrefObject Also known as: to_s



12
# File 'lib/xml/smart_domnamespace.rb', line 12

def href; @ns.href; end

#prefixObject



15
16
17
18
19
20
21
# File 'lib/xml/smart_domnamespace.rb', line 15

def prefix
  if @ns.prefix
    @ns.prefix
  else
    @ns.document.custom_namespace_prefixes.find{|k,v| v == @ns.href}[0]
  end
end