PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > [ANN] NotNaughty - Validation Framework 0.4
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
[ANN] NotNaughty - Validation Framework 0.4

Réponse
 
LinkBack Outils de la discussion
Vieux 25/02/2008, 14h57   #1
Florian Aßmann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut [ANN] NotNaughty - Validation Framework 0.4

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

  Réponse avec citation
Vieux 25/02/2008, 15h04   #2
Avdi Grimm
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [ANN] NotNaughty - Validation Framework 0.4

On Mon, Feb 25, 2008 at 9:57 AM, Florian A=DFmann
<florian.assmann@email.de> wrote:

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

--=20
Avdi

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h13.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,06909 seconds with 10 queries