acts_as_strippable_on 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 63b6f3b258b3a1eb9b4f6ff90ce410c5a647beb5
4
+ data.tar.gz: da07f31b9de55ea364f4059f1b3da3e4f3140609
5
+ SHA512:
6
+ metadata.gz: bd3607c06fa4c8dd4c9d66f68b1b20c108bc76b24fbb29e971c5c0c3ed0976dd03b7c179b2f3e3e895ed75a71bf4c06d1b41a6cc89498d55d52f069d312a2edf
7
+ data.tar.gz: 58a9d8e30c9b47852ffdd617c7f857ac044c95c13e91afc06ebcaee5f167200d743648e8a8abca279faa6e7133c2d96b78b0acc7596a5390b1c5795838818fc3
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
13
+
14
+ .ruby-gemset
15
+ .ruby-version
16
+ .idea
17
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,37 @@
1
+ Rails:
2
+ Enabled: true
3
+ AllCops:
4
+ TargetRubyVersion: 2.4
5
+ TargetRailsVersion: 5.1
6
+ Metrics/LineLength:
7
+ Max: 120
8
+ Metrics/ClassLength:
9
+ Max: 200
10
+ Documentation:
11
+ Enabled: false
12
+ Style/SignalException:
13
+ Enabled: false
14
+ Style/ClassAndModuleChildren:
15
+ Enabled: false
16
+ Style/FrozenStringLiteralComment:
17
+ Enabled: false
18
+ Style/FormatStringToken:
19
+ EnforcedStyle: template
20
+ PercentLiteralDelimiters:
21
+ PreferredDelimiters:
22
+ '%i': ()
23
+ '%w': ()
24
+ Metrics/ClassLength:
25
+ Max: 200
26
+ Metrics/ModuleLength:
27
+ Exclude:
28
+ - '**/*_spec.rb'
29
+ Metrics/BlockLength:
30
+ Exclude:
31
+ - 'spec/**/*'
32
+ - '*.gemspec'
33
+ Rails/SkipsModelValidations:
34
+ Exclude:
35
+ - 'spec/**/*'
36
+ Rails/ApplicationRecord:
37
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in acts_as_strippable_on.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Vital Ryabchinskiy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # ActsAsStrippableOn
2
+
3
+ Easy way to define AR attributes that should be stripped before save
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'acts_as_strippable_on'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install acts_as_strippable_on
20
+
21
+ ## Usage
22
+
23
+ Setup
24
+
25
+ ```ruby
26
+ class User < ActiveRecord::Base
27
+ acts_as_strippable_on :email, :login
28
+ end
29
+ ```
30
+
31
+ Attributes `email` and `login` will be stripped before model validation.
32
+
33
+ ## Contributing
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
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'acts_as_strippable_on/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'acts_as_strippable_on'
9
+ spec.version = ActsAsStrippableOn::VERSION
10
+ spec.authors = ['Vital Ryabchinskiy']
11
+ spec.email = ['vital.ryabchinskiy@gmail.com']
12
+
13
+ spec.description = 'Easy way to define AR attributes that should be stripped before save'
14
+ spec.summary = 'Provide functionality to strip AR attributes'
15
+ spec.homepage = 'https://github.com/vitalinfo/acts_as_strippable_on'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.15'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'rubocop', '~> 0.49'
29
+ spec.add_development_dependency 'sqlite3', '~> 1.3'
30
+
31
+ spec.add_runtime_dependency 'activerecord', '>= 4.0.0', '<= 6.0'
32
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'acts_as_strippable_on'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ require 'active_record'
2
+ require 'acts_as_strippable_on/version'
3
+ require 'acts_as_strippable_on/core'
4
+
5
+ module ActsAsStrippableOn
6
+ include ActsAsStrippableOn::Core
7
+ end
8
+
9
+ # Extend ActiveRecord's functionality
10
+ ActiveRecord::Base.send :extend, ActsAsStrippableOn
@@ -0,0 +1,11 @@
1
+ module ActsAsStrippableOn
2
+ module Core
3
+ def acts_as_strippable_on(*attributes)
4
+ before_validation do
5
+ attributes.each do |attribute|
6
+ send(attribute).strip! if send(attribute).present? && send(attribute).respond_to?(:strip!)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module ActsAsStrippableOn
2
+ VERSION = '0.1.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_strippable_on
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vital Ryabchinskiy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-07-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.49'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.49'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activerecord
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 4.0.0
90
+ - - "<="
91
+ - !ruby/object:Gem::Version
92
+ version: '6.0'
93
+ type: :runtime
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 4.0.0
100
+ - - "<="
101
+ - !ruby/object:Gem::Version
102
+ version: '6.0'
103
+ description: Easy way to define AR attributes that should be stripped before save
104
+ email:
105
+ - vital.ryabchinskiy@gmail.com
106
+ executables: []
107
+ extensions: []
108
+ extra_rdoc_files: []
109
+ files:
110
+ - ".gitignore"
111
+ - ".rspec"
112
+ - ".rubocop.yml"
113
+ - ".travis.yml"
114
+ - Gemfile
115
+ - LICENSE.txt
116
+ - README.md
117
+ - Rakefile
118
+ - acts_as_strippable_on.gemspec
119
+ - bin/console
120
+ - bin/setup
121
+ - lib/acts_as_strippable_on.rb
122
+ - lib/acts_as_strippable_on/core.rb
123
+ - lib/acts_as_strippable_on/version.rb
124
+ homepage: https://github.com/vitalinfo/acts_as_strippable_on
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.12
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Provide functionality to strip AR attributes
148
+ test_files: []