Class: OpenXmlObject
- Defined in:
- lib/mappum/open_xml_object.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mappum/open_xml_object.rb', line 23 def method_missing(sym, *args, &block) safename = XSD::CodeGen::GenSupport.safemethodname(sym.to_s).to_sym if safename != sym and self.respond_to?(safename) return self.send(safename, *args, &block) end if sym.to_s[-1..-1] == "=" then if sym.to_s[0..7] == "xmlattr_" #attribute name = sym.to_s[8..-2] __add_xmlattr_from_method(name, args[0]) else #element __add_xmlele_from_method(sym.to_s[0..-2], args[0]) end else super(sym, *args, &block) end end |