[ANN] doodle-0.0.9 released

S

Sean O'Halpin

Doodle 0.0.9 has been released.

Doodle simplifies the definition of Ruby classes by providing a simple
DSL for declaring attribute validations and conversions.

Doodle is eco-friendly =96 it does not globally modify Object, Class or
Module (and it plays nice with yaml).

For more info and examples, see the docs at http://doodle.rubyforge.org.

Changes for 0.0.9:

- new features:
- :collect now creates array by default if no :init specified
(thanks to James Adam :)
- :collect can now initialize from Enumerables by default
- raise UnknownAttributeError if initialize called with unspecified
attribute key
- added experimental Doodle.context and Doodle.parent (only valid
during initialization)
- new examples:
- datatypes
- mail example
- Doodle.parent
- new specs for singletons, Doodle.context and Doodle.parent, factory
- updated docs
- removed unused code and tidied up
- bug fixes:
- fixed memory leak
- fixed regex for factory methods
- fixed bug where validate! was creating instance variables with defaults
- fixed errors collection
- fixed yaml test for JRuby
- now doesn't try to define factory method if one with same name
already defined

Regards,
Sean
 
T

Trans

Doodle 0.0.9 has been released.

Doodle simplifies the definition of Ruby classes by providing a simple
DSL for declaring attribute validations and conversions.

Doodle is eco-friendly - it does not globally modify Object, Class or
Module (and it plays nice with yaml).

For more info and examples, see the docs athttp://doodle.rubyforge.org.

Changes for 0.0.9:

- new features:
- :collect now creates array by default if no :init specified
(thanks to James Adam :)
- :collect can now initialize from Enumerables by default
- raise UnknownAttributeError if initialize called with unspecified
attribute key
- added experimental Doodle.context and Doodle.parent (only valid
during initialization)
- new examples:
- datatypes
- mail example
- Doodle.parent
- new specs for singletons, Doodle.context and Doodle.parent, factory
- updated docs
- removed unused code and tidied up
- bug fixes:
- fixed memory leak
- fixed regex for factory methods
- fixed bug where validate! was creating instance variables with defaults
- fixed errors collection
- fixed yaml test for JRuby
- now doesn't try to define factory method if one with same name
already defined

Regards,
Sean

Hi Sean,

Doodle looks very promising. I especially like the use on annotation-
style attribute options.

Couple of questions:

1. None of the examples define regular methods. Is Doodle just for
data classes?

2. Are you currently using this in any of your other apps?

Thanks,
T.
 
S

Sean O'Halpin

Hi Sean,

Doodle looks very promising. I especially like the use on annotation-
style attribute options.

Couple of questions:

1. None of the examples define regular methods. Is Doodle just for
data classes?

Not at all. The examples focus on data definition because that's what
Doodle is for. However, I am finding that I'm defining fewer methods
on classes simpy because Doodle handles a lot of what those methods
would be doing. One of the nice things about Doodle is that it makes
it much clearer what are the properties of an object (attributes +
constraints) and what are its behaviours (methods). But if it's
methods you're after, the latest version has a mail.rb example
(translated from an example in Florian Frank's dslkit) which defines a
#send method :)
2. Are you currently using this in any of your other apps?

Yes. At work, we're using it in the development branch of what will
shortly be a production application. It handles validation of yaml
configuration files. While this is only using a subset of Doodle, it
greatly simplifies the task.

I have also been using it for my own experimental projects. For
example, I've been toying with an interactive fiction DSL, a
Ruby-centric ORM, code generation and a command-line option handler.
They're all kind of related and Doodle is making it much easier to see
and share the similarities. One of the most promising directions of
this experimentation is shared 'rich datatypes'. For example, doing
this:

class Mail < Doodle::Base
doodle do
email :to
email :from
end
...
end

defines attributes that accept only RFC822-compliant email addresses.
Look at examples/datatypes.rb for some sample datatype definitions and
examples/mail-datatypes.rb to see how they're used. (Note that this is
enabled in the examples, not in the lib). These are in svn on
rubyforge, not in the gem.

Having said that, Doodle is very much a work-in-progress (as will be
evident to anyone reading the code!). There's a fair bit of behaviour
that's not covered by specs and a few tortuous workarounds. In
particular, I'm finding I keep getting tied up in knots trying to
handle singleton classes consistently. I've had to use some dubious
hacks in places - the most egregious being reading an object's inspect
string to determine if it's a singleton class. (BTW, If anyone knows a
better way to discover whether self is a singleton class without
creating a singleton class in the process, I'd be grateful to learn
it.)

While I sometimes get the feeling that I shouldn't be trying to do
this in Ruby (and I'm sure you appreciate what I mean :), I am
committed to seeing this through - I'm finding it too useful and fun
to stop now :)
Thanks,
T.

Best regards,
Sean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top