Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
a simple plugin to sanitize fields on sequel models
Ruby
branch: master

This branch is 1 commit behind kevintom:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
CHANGELOG
LICENSE
README.rdoc
Rakefile
sequel_sanitize.gemspec

README.rdoc

sequel_sanitize

Install

Add gemcutter.org source if you don't have it:

gem source http://gemcutter.org

Install:

[sudo] gem install sequel_sanitize

Usage

This plug-in provide functionality to allow Sequel::Model to have fields sanitized with a defined or default method.

To use plug-in you add plug-in to your model:

class MyModel < Sequel::Model
  plugin :sanitize, :fields => [:first_name, :last_name], :sanitizer => :name_sanitizer
  plugin :sanitize, :fields => [:email], :downcase => true
end

You can use following options:

fields

an array of the fields that the sanitizer method should be applied to

sanitizer

Proc or Symbol to call to sanitize the value of the field.

downcase

Set to true to downcase the value returned from the sanitizer

Options sanitizer and downcase are optional.

Options are inherited when you use inheritance for your models. However you can only set options via plugin method.

If you don't provide a :sanitizer, the default sanitizer method will strip whitespace

Copyright

Copyright © 2011 Kevin Tom. See LICENSE for details.

Something went wrong with that request. Please try again.