README.markdown in mask_validator-0.2.1 vs README.markdown in mask_validator-0.2.2
- old
+ new
@@ -1,33 +1,45 @@
-# MaskValidator
+# Mask Validator
+[![Gem Version](https://badge.fury.io/rb/mask_validator.png)](http://badge.fury.io/rb/mask_validator)
+
This gem was inspired in the Sobrinho's gems to validate simple things inside of ActiveModel.
-Use mask in inputs and validate in the models.
+The gem works getting the value before type cast and comparing with a regular expression from the parse of mask pattern.
-The gem works getting the value before type cast and comparing with a regexp from the mask pattern.
-
## Installation
-Use the github version until a really stable version be released.
+Put `gem "mask_validator", "0.2.1"` in the Gemfile
-`gem "mask_validator", :git => "git://github.com/MarceloCajueiro/mask_validator.git"`
+## Usage
-## Usage:
+```ruby
+validates :phone, :mask => "(99) 9999-9999"
-`validates :phone, mask: "(99) 9999-9999"`
+validates :acronym, :mask => "***"
-`validates :acronym, mask: "***"`
+validates :acronym, :mask => :custom_method
-`validates :acronym, mask: :custom_method`
+validates :acronym, :mask => Proc.new { |o| o.custom_method }
+```
-`validates :acronym, mask: Proc.new{|o| o.custom_method}`
-
-* a - Represents an alpha character (A-Z,a-z)
+* a - Represents an alpha character (A-Z, a-z)
* 9 - Represents a numeric character (0-9)
-* * - Represents an alphanumeric character (A-Z,a-z,0-9)
+* * - Represents an alphanumeric character (A-Z, a-z, 0-9)
For more information about masks in the form inputs check the jquery plugin [Masked input](http://digitalbush.com/projects/masked-input-plugin/)
+
+## Application example
+
+Use a little trick to call the masked input (jquery plugin) only defining the validation in the model.
+
+In other words, defining:
+
+```ruby
+validates :phone, :mask => "(99) 9999-9999"
+```
+
+It is the only necessary thing to apply the masked input.
## License
Copyright © 2011 Marcelo Cajueiro, released under the MIT license