attr_filters 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5d9621f613bdb9188c3e39ce6cc9d9c7d0d310fc7f3c5b1fe301e46f40250f4
4
- data.tar.gz: aead70cf656f6fb587fd811b5c7a68e10464d0e291fe22e1360b374efce0a4d6
3
+ metadata.gz: 97bb54568e619193e916547fb341d07a4dff26203a3c1892e7560064e367e7d0
4
+ data.tar.gz: 7086278f77d84a920b55b61c0afc581e04fb5496f913e90a3802f19f6917bf37
5
5
  SHA512:
6
- metadata.gz: 95e5e1a38c9405ea7f7e14b9770106afeaae9ab1ab3e0540c2d7d9fa74cc35cfe295f1ef73ab9f855876a68a98735039496a4d29eab0eea564af59bcc8782e5c
7
- data.tar.gz: 7593f45e1d12da007104abc013eb98ebff60dc6d2dc6db13bb9892e3fd270ab0d50997568b72c7f159440ac000d68edc064f484901a95e63d37552506abdfa84
6
+ metadata.gz: cada13d445118bbb08f414a8f8e85c1d227771fbebac0ed51ecbffa4ca1e19f3b9d70a936be25cc128fc2cdc28231704e708b4b06e0e88869935058f3482c886
7
+ data.tar.gz: 406ede63fe8d8e3db46fcf2b9efc3f310a816ece1242dbfdf9ca9358033b69f7a583b9271f2b1df7370e6643b56cb9fd5b8b27e8f4c852b9fc4c401e3fe20906
data/README.md CHANGED
@@ -39,11 +39,13 @@ You can add filters like that:
39
39
  class SingupForm
40
40
  include AttrFilters
41
41
 
42
- attr_accessor :email, :first_name, :last_name, :zip
42
+ attr_accessor :email, :first_name, :last_name, :zip, :birth_date, :due_date
43
43
 
44
44
  filters :email, trim: true, downcase: true
45
45
  filters :first_name, :last_name, trim: true, letters_only: true
46
46
  filters :zip, trim: true, numbers_only: true
47
+ filters :birth_date, date: true
48
+ filters :due_date, date: "%m-%d-%Y"
47
49
  end
48
50
  ```
49
51
 
@@ -57,6 +59,8 @@ form.email = " mike.dou@example.com "
57
59
  form.first_name = "Mike 123"
58
60
  form.last_name = " Dou"
59
61
  form.zip = "abc12345"
62
+ form.birth_date = "2019-11-02"
63
+ form.due_date = "11-02-2019"
60
64
 
61
65
  form.filter!
62
66
 
@@ -64,6 +68,8 @@ form.email # => "mike.dou@example.com"
64
68
  form.first_name # => "Mike"
65
69
  form.last_name # => "Dou"
66
70
  form.zip # => "12345"
71
+ form.birth_date # => #<Date: 2019-11-02 ((2458790j,0s,0n),+0s,2299161j)>
72
+ form.due_date # => #<Date: 2019-11-02 ((2458790j,0s,0n),+0s,2299161j)>
67
73
  ```
68
74
 
69
75
  ## Integration with Rails
@@ -117,13 +123,9 @@ form.zip # => "12345"
117
123
  - `squeeze` - removes duplicating whitespaces
118
124
  - `numbers_only` - removes non digits characters
119
125
  - `letters_only` - removes non letter characters
126
+ - `date` - parse string to date using specified format. Default format is **`%Y-%m-%d`**.
120
127
 
121
128
 
122
- ## Development
123
-
124
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
125
-
126
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
127
129
 
128
130
  ## Contributing
129
131
 
@@ -140,4 +142,4 @@ Everyone interacting in the AttrFilters project’s codebases, issue trackers, c
140
142
 
141
143
  ## Authors
142
144
 
143
- [Syndicode.com](https://syndicode.com)
145
+ [Syndicode.com](https://syndicode.com)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AttrFilters
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_filters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Holovko