From: "Aurimas N." Date: 2012-11-19T18:19:48+09:00 Subject: Metaprogramming Hello, I am doing one open source project and I hit the wall with this. Now I am writing lib which would convert custom xml format to Ruby objects and back to xml. I have finished translating DTD to Classes but it is really messy and really big and lack many features that I want to do (https://github.com/gcds/libeagle/blob/master/lib/libeagle/eagle.rb). So I asking maybe someone could help me to write some methods in meta programming because I am new with it and cant figure out how to do. Google doesn't provide good results. I could use already written libraries like Doodle, ActiveModel but it would be to heavy. What I want to do is this: I am trying to make method which would set getter, setter, default value, and would check if attribute is filled in. class Library < Eagle::Base attribute :name, :default => "Tom", :required => true end Another method that replicates .new method which would take nokogiri doc and would catch all attributes which are defined with first method and get values. xml['name'] = "John" lib = Library.newXML(xml) lib.name => "John" And the last method To take all atributes which are defined with the first one (maybe save attribute name to array?) run validations and make xml block from that attributes. So if someone could help with this things I would be really appreciate. And your help will help to release this project to open community. Thank you. Aurimas -- Posted via http://www.ruby-forum.com/.