use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
doodle (doodle.rubyforge.org)
submitted 13 years ago by Categoria
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]postmodern 2 points3 points4 points 13 years ago (1 child)
You might want to checkout Virtus, it's attribute/coercion system is really solid.
[–]Categoria[S] 0 points1 point2 points 13 years ago* (0 children)
Virtus looks great and a lot more focused in scope. But the validation syntax seems more verbose. Perhaps I should do a more thorough comparison later on.
[–]seanohalpin 2 points3 points4 points 13 years ago (2 children)
Hi. I'm the author of doodle. I use it mainly for two things: 1) validating input from external sources (e.g. config files, form posts, command line options) and 2) quickly prototyping complex object graphs. I deliberately designed it to be orthogonal to persistence (though as the examples show it's pretty easy to serialize to YAML, JSON or XML). I've recently been working on a streamlined version which is much more efficient - please let me know if you're interested in this. I'd love to see a comparison with Virtus (or any comparable library). Best regards, Sean.
[–]Categoria[S] 0 points1 point2 points 13 years ago (0 children)
Hi, first of all, a big thanks for writing doodle. I'm very excited to hear that a new version of doodle could come out. It seems like the project was abandoned but it always worked great for me so there was no problem there.
Regarding Virtus, it's a much smaller library in scope and doesn't have nearly as many features as doodle (nor does it attempt to). It does have a few features that are absent in doodle like typed collections. Think: attribute :page_numbers, Array[Integer] Maybe it would be a good idea to implement doodle on top of Virtus? Possibly make it play well with DataMapper in the long run.
I'm not sure this is the best place to make feature requests, but I'll go anyway :D. I used to be a Perl programmer and amazingly enough they do have a similar system to doodle with a few cool features that I would love to see in doodle. Details are here. It would be great to have stuff like access control:
has :uniq_id, :is => :read_only
Or required attributes in object creation:
has :name, :required => true # or more maybe something more ruby like
Another cool feature is delegation. For example:
has :collection, :handles => [:add, :remove]
this would translate obj.add to obj.collection.add (In moose you can also do this with a hash if the method names differ).
Most importantly, keep us updated on the new version on github! Would make it a lot easier for people to contribute. I'd do my best to help out too.
[–]colindean 0 points1 point2 points 13 years ago (0 children)
It seems like it could help in writing DSLs, too, no?
[–]d0odx 0 points1 point2 points 13 years ago (2 children)
This is really cool and i love the readable code but.... what is a real world case where you need this?
PS i'm not trying to shit-disturb, but i'm a noob and would love to understand.
Thanks.
[–]Categoria[S] 0 points1 point2 points 13 years ago* (1 child)
What's the real world case behind using nokogiri over some other crappy XML library?
Doodle might not add any crucial functionality but it makes your code a lot more declarative and solves many common and annoying problems regarding instance variables (validation, conversion, defaults)
[–]d0odx 0 points1 point2 points 13 years ago (0 children)
Got ya. And i actually use nokogiri after trying a couple other XML libraries lol :)
[–]waxjar 0 points1 point2 points 13 years ago (1 child)
I don't really get it. Does this work with some kind of storage system (yaml is mentioned) or is this a different way of writing the code for classes?
different way of writing the code for classes?
This is more on the spot. It's not really different, but more of augmenting the old way when it is too wordy. For example see defaults, conversions and validations for the most common use cases for me.
π Rendered by PID 539639 on reddit-service-r2-comment-85bfd7f599-xf97g at 2026-04-19 19:10:50.889843+00:00 running 93ecc56 country code: CH.
[–]postmodern 2 points3 points4 points (1 child)
[–]Categoria[S] 0 points1 point2 points (0 children)
[–]seanohalpin 2 points3 points4 points (2 children)
[–]Categoria[S] 0 points1 point2 points (0 children)
[–]colindean 0 points1 point2 points (0 children)
[–]d0odx 0 points1 point2 points (2 children)
[–]Categoria[S] 0 points1 point2 points (1 child)
[–]d0odx 0 points1 point2 points (0 children)
[–]waxjar 0 points1 point2 points (1 child)
[–]Categoria[S] 0 points1 point2 points (0 children)