(Not documented)
# File lib/r4x/e4x.rb, line 179 def new( xd=[], to=nil, tp=nil ) case xd when XmlList xd else __new( xd, to, tp ) end end
(Not documented)
# File lib/r4x/e4x.rb, line 189 def initialize( xd=[], to=nil, tp=nil ) @self = XmlListDelegate.new(self) case xd when [] @list = [] @target_object = to @target_property = tp when Xml @list = [xd] @target_object = xd.self.parent @target_property = xd.self.name else xd = REXML::Document.new(%{<_>#{xd}</_>}).root a = []; xd.each{ |n| a << Xml.new(n) } @list = a @target_object = nil @target_property = nil end end
XPath for all elements.
# File lib/r4x/e4x.rb, line 241 def * ; @self.get('*') ; end
Shortcut for add.
# File lib/r4x/e4x.rb, line 236 def <<( n ) @self.add( n ) end
(Not documented)
# File lib/r4x/e4x.rb, line 246 def []( v ) @self.get( v ) end
(Not documented)
# File lib/r4x/e4x.rb, line 250 def []=( prop, v ) @self.put( prop , v ) end
Shortcut for XPath ’@*’, meaning all attributes.
# File lib/r4x/e4x.rb, line 244 def _ ; @self.get('@*') ; end
This is how the delegate accesses the node classification.
# File lib/r4x/e4x.rb, line 216 def __class ; :xmllist ; end
This is how the delegate accesses the node.
# File lib/r4x/e4x.rb, line 213 def __list ; @list ; end
This is how the delegate accesses the node classification.
# File lib/r4x/e4x.rb, line 219 def __target_object ; @target_object ; end
(Not documented)
# File lib/r4x/e4x.rb, line 220 def __target_object=(to) ; @target_object = to ; end
This is how the delegate accesses the node classification.
# File lib/r4x/e4x.rb, line 223 def __target_property ; @target_property ; end
(Not documented)
# File lib/r4x/e4x.rb, line 224 def __target_property=(tp) ; @target_property = tp ; end
each
# File lib/r4x/e4x.rb, line 233 def each(&blk) ; @list.each(&blk) ; end
# File lib/r4x/e4x.rb, line 255 def method_missing( sym, *args ) sym = sym.to_s p sym if (args.size > 0) self[0].send( sym, args ) else self[0].send( sym ) end end
This is how to access the underlying Xml object, i.e. via the delegate.
# File lib/r4x/e4x.rb, line 210 def self ; @self ; end
Disabled; run with --debug to generate this.