Class: XML::Smart::QName
- Inherits:
-
Object
- Object
- XML::Smart::QName
- Defined in:
- lib/xml/smart_qname.rb
Instance Method Summary collapse
- #+(str) ⇒ Object
- #==(str) ⇒ Object
- #===(cls) ⇒ Object
- #href ⇒ Object
-
#initialize(element) ⇒ QName
constructor
A new instance of QName.
- #name ⇒ Object
- #name=(n) ⇒ Object
- #prefix ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
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 |
#href ⇒ Object
28 29 30 |
# File 'lib/xml/smart_qname.rb', line 28 def href @element.namespace ? @element.namespace.href : nil end |
#name ⇒ Object
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 |
#prefix ⇒ Object
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_s ⇒ Object
11 |
# File 'lib/xml/smart_qname.rb', line 11 def to_s; (prefix.nil? || prefix == '' ? '' : prefix + ':') + @element.name; end |
#to_sym ⇒ Object
12 |
# File 'lib/xml/smart_qname.rb', line 12 def to_sym; to_s.to_sym; end |