Class: XmlEasy::ElementList

Inherits:
Array
  • Object
show all
Defined in:
lib/xml_easy.rb

Instance Method Summary collapse

Methods inherited from Array

#to_element_list

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/xml_easy.rb', line 269

def method_missing(name, *args, &block)
  elms = []
  errs = []
  off_debug do
    elms = map do |e| 
      begin; e.send(name, *args, &block) 
      rescue => e; errs << e and [] end
    end.flatten
  end
  #puts errs.map{|e| e.message}.join("\n") if $xmleasy_debug or $debug

  unless block.nil?
    elms = elms.select &block
  end
  elms.to_element_list
end