acts_as_downcasable_on 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dbb3ffb6759d4a22eb082d07f11c504424eefa50
4
- data.tar.gz: 51a02829271891ba419bf0305b2e678df9f6266d
3
+ metadata.gz: 984c1d09fc6b58980fd1dc2d2d52d747f6af0ebd
4
+ data.tar.gz: aa788f345755bd18c05737acc23e62466972d9a3
5
5
  SHA512:
6
- metadata.gz: 493d0efa0f470fa9cf5ba0de2e60571c94454b831f22af915bb450739ff4023025c07622e3d3fc3912ab76437d848c4deb28d27728d8fbbeaa554fa5d67796aa
7
- data.tar.gz: 3d8afdd04f81b41f3213cea93cfb8d7c1631af3b2b56b6a59bf71e1e1583f73b389a068b2bd1e71415275509f64052abd7f602edd0c71aeee8836fcfe9931508
6
+ metadata.gz: 2acab39371d0b3ff1f6ece2e9afbedb4591aa62ab6890ef88f92844f40c3d246e37b95dc3798814916937efe104b0a0fcba293154902884c58b6bcce1bceba70
7
+ data.tar.gz: addcb5192f61a78688fefca8f9dc2724cf9f6cde2b6699b2e1b6c0e26ca676c8d75322af02dfcfd20a209d82c1a9b95b015fa3e604259476f198eeec6faa91a3
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # ActsAsDowncasableOn
1
+ # ActsAsDowncasableOn
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/acts_as_downcasable_on`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Easy way to define AR attributes that should be stored in lowercase
6
4
 
7
5
  ## Installation
8
6
 
@@ -19,25 +17,22 @@ And then execute:
19
17
  Or install it yourself as:
20
18
 
21
19
  $ gem install acts_as_downcasable_on
22
-
20
+
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
23
+ Setup
28
24
 
29
- 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.
25
+ ```ruby
26
+ class User < ActiveRecord::Base
27
+ acts_as_downcasable_on :email, :login
28
+ end
29
+ ```
30
30
 
31
- 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).
31
+ Attributes `email` and `login` will be forced to lowercase before model validation.
32
32
 
33
33
  ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/acts_as_downcasable_on. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
- ## License
38
-
39
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the ActsAsDowncasableOn project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/acts_as_downcasable_on/blob/master/CODE_OF_CONDUCT.md).
34
+ 1. Fork it
35
+ 2. Create your feature branch (git checkout -b my-new-feature)
36
+ 3. Commit your changes (git commit -am 'Add some feature')
37
+ 4. Push to the branch (git push origin my-new-feature)
38
+ 5. Create new Pull Request
@@ -3,7 +3,7 @@ module ActsAsDowncasableOn
3
3
  def acts_as_downcasable_on(*attributes)
4
4
  before_validation do
5
5
  attributes.each do |attribute|
6
- send(attribute).downcase! if send(attribute).present?
6
+ send(attribute).downcase! if send(attribute).present? && send(attribute).respond_to?(:downcase!)
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module ActsAsDowncasableOn
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_downcasable_on
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vital Ryabchinskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-02 00:00:00.000000000 Z
11
+ date: 2017-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,7 +111,6 @@ files:
111
111
  - ".rspec"
112
112
  - ".rubocop.yml"
113
113
  - ".travis.yml"
114
- - CODE_OF_CONDUCT.md
115
114
  - Gemfile
116
115
  - LICENSE.txt
117
116
  - README.md
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at vital.ryabchinskiy@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/