[ANN] NotNaughty - Validation Framework 0.4

F

Florian Aßmann

Hi folks,

I just released my first gem. It's a validation framework that targets an easy
way of creating validations and reuse them in any ruby project that needs to
validate any kind of values.

It's syntax is close to the ActiveRecord and Assistance validations with some
enhancements.

http://rubyforge.org/projects/not-naughty

== Features

* Easy to extend
* Easy to adapt (provides an adapter/plugin for sequel models)

class MyClass
extend NotNaughty
validated_before :clone

# *snip*

end

class MyModel < Sequel::Model
is :not_naughty
end

* Supports inheritance
* Validator can handle object states
* Supports chained conditions for validations
* Comes with default validations for presence, length, ...
* Magic builder methods that take global attributes and conditions

validates:)attribute1, :attribute2) {
confirmation and presence :if => [:true?, :really_true?]
}
validates {
confirmation_of :attribute1, :attribute2
presence_of :attribute1, :attribute2, :if => [:true?, :really_true?]
}
validates:)if => [:true?, :really_true?]) {
presence_of :attribute1, :attribute2
}

They just drop in if you inherit from NotNaughty::Validation.

* Error messages are eval'ed (not glued) which gives you more control
* Lots of examples in the specs and documentation

== Installation

sudo gem install not_naughty

== ToDo

Awaiting feature requests...

Cheers
Florian
 
A

Avdi Grimm

On Mon, Feb 25, 2008 at 9:57 AM, Florian A=DFmann

Nice! A non ActiveRecord-specific validations module is something
I've wanted in the past.

--=20
Avdi
 

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,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top