README.md in input_sanitizer-0.2.0 vs README.md in input_sanitizer-0.2.2

- old
+ new

@@ -17,16 +17,14 @@ $ gem install input_sanitizer ## Usage ```ruby - class PersonSanitizer < InputSanitizer::Sanitizer string :name string :address integer :height - float :weight date :birthday end # filters unwanted parameters sanitizer = PersonSanitizer.new({:account_id => 1, :name => "John"}) @@ -55,10 +53,18 @@ # it prevents obvious errors data = PrivilegedSanitizer.clean({:account_id => 3}) data[:account] # instead of :account_id # => InputSanitizer::KeyNotAllowedError: Key not allowed: account -# => ... + +# supports custom value converters +class SomethingSanitizer < InputSanitizer::Sanitizer + custom :backward, :converter => lambda { |v| v.reverse } + integer :version + custom :name, :provide => :version, :converter => lambda { |name, version| + version < 3 ? name.downcase : name + } +end ``` ## Contributing