Class: XML::Smart::QName

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

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ QName

Returns a new instance of QName.



5
# File 'lib/xml/smart_qname.rb', line 5

def initialize(element); @element = element; end

Instance Method Details

#+(str) ⇒ Object



9
# File 'lib/xml/smart_qname.rb', line 9

def +(str); @element.name + str; end

#==(str) ⇒ Object



7
# File 'lib/xml/smart_qname.rb', line 7

def ==(str); @element.name == str; end

#===(cls) ⇒ Object



8
# File 'lib/xml/smart_qname.rb', line 8

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

#hrefObject



28
29
30
# File 'lib/xml/smart_qname.rb', line 28

def href
  @element.namespace ? @element.namespace.href : nil
end

#nameObject



13
# File 'lib/xml/smart_qname.rb', line 13

def name; @element.name; end

#name=(n) ⇒ Object



14
# File 'lib/xml/smart_qname.rb', line 14

def name=(n); @element.name = n; end

#prefixObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/xml/smart_qname.rb', line 16

def prefix
  if @element.namespace 
    if @element.namespace.prefix.nil?
      ''
    else  
      @element.namespace.prefix
    end  
  else
    nil
  end
end

#to_sObject



11
# File 'lib/xml/smart_qname.rb', line 11

def to_s; (prefix.nil? || prefix == '' ? '' : prefix + ':') + @element.name; end

#to_symObject



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

def to_sym; to_s.to_sym; end