Class: Dbxml::XmlDocument::MetaData
- Inherits:
-
Object
- Object
- Dbxml::XmlDocument::MetaData
- Includes:
- Enumerable
- Defined in:
- lib/rdbxml.rb
Overview
Represents the document metadata as an Enumerable collection
Instance Method Summary collapse
- #[](name, ns = '') ⇒ Object
- #[]=(name, *args) ⇒ Object
- #delete(name, ns = '') ⇒ Object
-
#each(&block) ⇒ Object
:yields: name, value, uri.
-
#initialize(doc) ⇒ MetaData
constructor
:nodoc:.
- #inspect ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(doc) ⇒ MetaData
:nodoc:
130 131 132 |
# File 'lib/rdbxml.rb', line 130 def initialize(doc) #:nodoc: @doc = doc end |
Instance Method Details
#[](name, ns = '') ⇒ Object
134 135 136 137 |
# File 'lib/rdbxml.rb', line 134 def [](name, ns = '') v = XmlValue.new @doc.getMetaData( ns, name.to_s, v ) ? v : nil end |
#[]=(name, *args) ⇒ Object
139 140 141 142 143 144 145 146 147 148 |
# File 'lib/rdbxml.rb', line 139 def []=(name, *args) opts = {} val = args.pop ns = args.shift || '' if val @doc.setMetaData ns, name.to_s, Dbxml::XmlValue.new(val) else delete name, ns end end |
#delete(name, ns = '') ⇒ Object
150 151 152 153 |
# File 'lib/rdbxml.rb', line 150 def delete(name, ns = '') #puts "removeMetaData: #{name.inspect}, #{ns.inspect}" @doc.removeMetaData ns, name.to_s end |
#each(&block) ⇒ Object
:yields: name, value, uri
155 156 157 158 159 160 |
# File 'lib/rdbxml.rb', line 155 def each(&block) # :yields: name, value, uri i = @doc.getMetaDataIterator while (xmd = i.next) yield xmd.get_name.to_sym, xmd.get_value, xmd.get_uri end end |
#inspect ⇒ Object
169 170 171 172 173 |
# File 'lib/rdbxml.rb', line 169 def inspect all = {} self.each { |n, v| all[n] = v } all.inspect end |
#size ⇒ Object
162 163 164 165 166 167 |
# File 'lib/rdbxml.rb', line 162 def size s = 0 i = @doc.getMetaDataIterator while i.next do s += 1 end s end |