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.
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.
I am trying to make method which would set getter, setter, default
value, and would check if attribute is filled in.
That makes no sense. You are going to have to learn enough ruby to be
able to talk ruby. I suggest you read a beginning ruby book.
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.
7stud, you are being needlessly belligerent. A moment’s Googling would
tell you that Aurimas is not a native English speaker, and you should
adjust your attitude accordingly.
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.
This is not difficult to understand, particularly in the context of the
code examples given.
Yep, I know. I will write normal readme file today. I am creating other
tool and I thought maybe it would be nice to give away library which
parses these files.
P.S. Maybe someone has some unwritten rules for gems?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.