active_validation 3.0.0 → 4.0.0
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 +4 -4
- data/.DS_Store +0 -0
- data/.fasterer.yml +19 -0
- data/.reek +36 -0
- data/.rubocop.yml +54 -0
- data/Gemfile +1 -1
- data/Rakefile +1 -1
- data/active_validation.gemspec +21 -18
- data/bin/console +4 -4
- data/bin/rake +6 -7
- data/config/locales/en.yml +83 -83
- data/lib/.DS_Store +0 -0
- data/lib/active_validation.rb +12 -83
- data/lib/active_validation/.DS_Store +0 -0
- data/lib/active_validation/railtie.rb +19 -0
- data/lib/active_validation/validators/alpha_numeric_validator.rb +11 -10
- data/lib/active_validation/validators/alpha_validator.rb +11 -10
- data/lib/active_validation/validators/base64_validator.rb +2 -1
- data/lib/active_validation/validators/boolean_validator.rb +4 -6
- data/lib/active_validation/validators/coordinate_validator.rb +8 -5
- data/lib/active_validation/validators/credit_card_validator.rb +35 -36
- data/lib/active_validation/validators/currency_validator.rb +3 -2
- data/lib/active_validation/validators/cusip_validator.rb +9 -6
- data/lib/active_validation/validators/email_validator.rb +4 -3
- data/lib/active_validation/validators/equality_validator.rb +14 -13
- data/lib/active_validation/validators/hex_validator.rb +2 -1
- data/lib/active_validation/validators/imei_validator.rb +7 -6
- data/lib/active_validation/validators/ip_validator.rb +4 -1
- data/lib/active_validation/validators/isbn_validator.rb +5 -4
- data/lib/active_validation/validators/isin_validator.rb +12 -9
- data/lib/active_validation/validators/mac_address_validator.rb +7 -3
- data/lib/active_validation/validators/name_validator.rb +3 -2
- data/lib/active_validation/validators/password_validator.rb +7 -2
- data/lib/active_validation/validators/phone_validator.rb +3 -2
- data/lib/active_validation/validators/sedol_validator.rb +4 -3
- data/lib/active_validation/validators/slug_validator.rb +2 -1
- data/lib/active_validation/validators/ssn_validator.rb +2 -1
- data/lib/active_validation/validators/tracking_number_validator.rb +73 -68
- data/lib/active_validation/validators/type_validator.rb +3 -2
- data/lib/active_validation/validators/url_validator.rb +12 -11
- data/lib/active_validation/validators/username_validator.rb +2 -1
- data/lib/active_validation/validators/uuid_validator.rb +12 -11
- data/lib/active_validation/version.rb +1 -1
- metadata +51 -29
- data/lib/active_validation/matchers/ensure_valid_alpha_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_alpha_numeric_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_base64_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_boolean_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_coordinate_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_credit_card_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_currency_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_cusip_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_email_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_equality_matcher_of.rb +0 -40
- data/lib/active_validation/matchers/ensure_valid_hex_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_imei_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_ip_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_isbn_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_isin_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_mac_address_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_name_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_password_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_phone_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_sedol_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_slug_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_ssn_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_tracking_number_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_type_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_url_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_username_format_of.rb +0 -26
- data/lib/active_validation/matchers/ensure_valid_uuid_format_of.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83dbcd9c5139b1142d10c326acc7288074e7491
|
4
|
+
data.tar.gz: 284f00a5ce2cd119744ff459e8edfc284b39fa51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 701b05b9a643a5fcb12a2968fa0e6d7516388a53ac75a1742f6135970d423c8c96d0b9701e889fcd71a90a6dda11af08f5716413e411747af6d8258cc7a7f83f
|
7
|
+
data.tar.gz: 1023027eed93960a34233a1e2f93df842677132dd7e24c6c4390e1e9f08518d535ad2f8d9676f7d52d9172a5671d7834fb9354830268a9d553dfe87eecd46b38
|
data/.DS_Store
ADDED
Binary file
|
data/.fasterer.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
speedups:
|
2
|
+
rescue_vs_respond_to: true
|
3
|
+
module_eval: true
|
4
|
+
shuffle_first_vs_sample: true
|
5
|
+
for_loop_vs_each: true
|
6
|
+
each_with_index_vs_while: false
|
7
|
+
map_flatten_vs_flat_map: true
|
8
|
+
reverse_each_vs_reverse_each: true
|
9
|
+
select_first_vs_detect: true
|
10
|
+
sort_vs_sort_by: true
|
11
|
+
fetch_with_argument_vs_block: true
|
12
|
+
keys_each_vs_each_key: true
|
13
|
+
hash_merge_bang_vs_hash_brackets: true
|
14
|
+
block_vs_symbol_to_proc: true
|
15
|
+
proc_call_vs_yield: true
|
16
|
+
gsub_vs_tr: true
|
17
|
+
select_last_vs_reverse_detect: true
|
18
|
+
getter_vs_attr_reader: true
|
19
|
+
setter_vs_attr_writer: true
|
data/.reek
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
Attribute:
|
3
|
+
enabled: false
|
4
|
+
BooleanParameter:
|
5
|
+
enabled: false
|
6
|
+
ControlParameter:
|
7
|
+
enabled: false
|
8
|
+
DataClump:
|
9
|
+
enabled: false
|
10
|
+
DuplicateMethodCall:
|
11
|
+
enabled: false
|
12
|
+
FeatureEnvy:
|
13
|
+
enabled: false
|
14
|
+
IrresponsibleModule:
|
15
|
+
enabled: false
|
16
|
+
InstanceVariableAssumption:
|
17
|
+
enabled: false
|
18
|
+
LongParameterList:
|
19
|
+
enabled: false
|
20
|
+
ManualDispatch:
|
21
|
+
enabled: false
|
22
|
+
NestedIterators:
|
23
|
+
max_allowed_nesting: 2
|
24
|
+
NilCheck:
|
25
|
+
enabled: false
|
26
|
+
PrimaDonnaMethod:
|
27
|
+
enabled: false
|
28
|
+
RepeatedConditional:
|
29
|
+
enabled: false
|
30
|
+
TooManyInstanceVariables:
|
31
|
+
enabled: false
|
32
|
+
TooManyStatements:
|
33
|
+
max_statements: 10
|
34
|
+
enabled: false
|
35
|
+
UtilityFunction:
|
36
|
+
enabled: false
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
AllCops:
|
2
|
+
DisplayCopNames: true
|
3
|
+
DisplayStyleGuide: true
|
4
|
+
TargetRubyVersion: 2.3
|
5
|
+
Exclude:
|
6
|
+
- 'spec/**/**/*'
|
7
|
+
LineLength:
|
8
|
+
Max: 100
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Enabled: false
|
15
|
+
Metrics/MethodLength:
|
16
|
+
Enabled: false
|
17
|
+
Metrics/ModuleLength:
|
18
|
+
Enabled: false
|
19
|
+
Metrics/ParameterLists:
|
20
|
+
Enabled: false
|
21
|
+
Metrics/PerceivedComplexity:
|
22
|
+
Enabled: false
|
23
|
+
Style/Alias:
|
24
|
+
EnforcedStyle: prefer_alias_method
|
25
|
+
Style/BracesAroundHashParameters:
|
26
|
+
Enabled: false
|
27
|
+
Style/ClassAndModuleChildren:
|
28
|
+
EnforcedStyle: compact
|
29
|
+
Style/ClassVars:
|
30
|
+
Enabled: false
|
31
|
+
Style/ClosingParenthesisIndentation:
|
32
|
+
Enabled: false
|
33
|
+
Style/Documentation:
|
34
|
+
Enabled: false
|
35
|
+
Style/EmptyLinesAroundBlockBody:
|
36
|
+
Enabled: false
|
37
|
+
Style/EmptyLinesAroundClassBody:
|
38
|
+
Enabled: false
|
39
|
+
Style/EmptyLinesAroundModuleBody:
|
40
|
+
Enabled: false
|
41
|
+
Style/HashSyntax:
|
42
|
+
Enabled: false
|
43
|
+
Style/FirstParameterIndentation:
|
44
|
+
Enabled: false
|
45
|
+
Style/FrozenStringLiteralComment:
|
46
|
+
Enabled: false
|
47
|
+
Style/MultilineMethodCallIndentation:
|
48
|
+
EnforcedStyle: aligned
|
49
|
+
Style/NumericLiterals:
|
50
|
+
Enabled: false
|
51
|
+
Style/RescueModifier:
|
52
|
+
Enabled: false
|
53
|
+
Style/SingleLineBlockParams:
|
54
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/active_validation.gemspec
CHANGED
@@ -1,30 +1,33 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require 'active_validation/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'active_validation'
|
8
8
|
spec.version = ActiveValidation::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Juan Gomez']
|
10
|
+
spec.email = ['j.gomez@drexed.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'Gem for commonly used validators.'
|
13
|
+
spec.description = 'Validate commonly used attributes easily with ActiveValidation.'
|
14
|
+
spec.homepage = 'http://drexed.github.io/active_validation'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_runtime_dependency
|
23
|
-
spec.add_runtime_dependency
|
22
|
+
spec.add_runtime_dependency 'activemodel'
|
23
|
+
spec.add_runtime_dependency 'activesupport'
|
24
24
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'coveralls'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
spec.add_development_dependency 'shoulda'
|
30
|
+
spec.add_development_dependency 'fasterer'
|
31
|
+
spec.add_development_dependency 'reek'
|
32
|
+
spec.add_development_dependency 'rubocop'
|
30
33
|
end
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'active_validation'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/bin/rake
CHANGED
@@ -2,15 +2,14 @@
|
|
2
2
|
#
|
3
3
|
# This file was generated by Bundler.
|
4
4
|
#
|
5
|
-
# The application
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
6
|
# this file is here to facilitate running it.
|
7
7
|
#
|
8
8
|
|
9
|
-
require
|
10
|
-
ENV[
|
11
|
-
Pathname.new(__FILE__).realpath)
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath)
|
12
11
|
|
13
|
-
require
|
14
|
-
require
|
12
|
+
require 'rubygems'
|
13
|
+
require 'bundler/setup'
|
15
14
|
|
16
|
-
load Gem.bin_path(
|
15
|
+
load Gem.bin_path('rake', 'rake')
|
data/config/locales/en.yml
CHANGED
@@ -2,115 +2,115 @@ en:
|
|
2
2
|
active_validation:
|
3
3
|
errors:
|
4
4
|
messages:
|
5
|
-
alpha:
|
6
|
-
alpha_numeric:
|
7
|
-
base64:
|
8
|
-
boolean:
|
5
|
+
alpha: 'is not a valid alpha characters'
|
6
|
+
alpha_numeric: 'is not a valid alpha-numeric characters'
|
7
|
+
base64: 'is not a valid Base64 encode'
|
8
|
+
boolean: 'is not a valid boolean'
|
9
9
|
coordinate:
|
10
|
-
coordinate:
|
11
|
-
latitude:
|
12
|
-
longitude:
|
13
|
-
credit_card:
|
14
|
-
currency:
|
15
|
-
cusip:
|
16
|
-
email:
|
17
|
-
equality:
|
18
|
-
hex:
|
19
|
-
imei:
|
20
|
-
ip:
|
21
|
-
isbn:
|
22
|
-
isin:
|
23
|
-
mac_address:
|
24
|
-
name:
|
25
|
-
password:
|
26
|
-
phone:
|
27
|
-
sedol:
|
28
|
-
slug:
|
29
|
-
ssn:
|
30
|
-
tracking_number:
|
31
|
-
type:
|
32
|
-
url:
|
33
|
-
username:
|
34
|
-
uuid:
|
10
|
+
coordinate: 'is not a valid coordinate'
|
11
|
+
latitude: 'is not a valid latitude'
|
12
|
+
longitude: 'is not a valid longitude'
|
13
|
+
credit_card: 'is not a valid credit card'
|
14
|
+
currency: 'is not a valid currency'
|
15
|
+
cusip: 'is not a valid CUSIP'
|
16
|
+
email: 'is not a valid email'
|
17
|
+
equality: 'is not %{operator} %{attr}'
|
18
|
+
hex: 'is not a valid hex color'
|
19
|
+
imei: 'is not a valid IMEI'
|
20
|
+
ip: 'is not a valid IP'
|
21
|
+
isbn: 'is not a valid ISBN'
|
22
|
+
isin: 'is not a valid ISIN'
|
23
|
+
mac_address: 'is not a valid MAC address'
|
24
|
+
name: 'is not a valid name'
|
25
|
+
password: 'is not a valid password'
|
26
|
+
phone: 'is not a valid phone number'
|
27
|
+
sedol: 'is not a valid SEDOL'
|
28
|
+
slug: 'is not a valid slug'
|
29
|
+
ssn: 'is not a valid social security number'
|
30
|
+
tracking_number: 'is not a valid tracking number'
|
31
|
+
type: 'is not a valid type'
|
32
|
+
url: 'is not a valid URL'
|
33
|
+
username: 'is not a valid username'
|
34
|
+
uuid: 'is not a valid UUID'
|
35
35
|
matchers:
|
36
36
|
ensure_valid_alpha_format_of:
|
37
|
-
failure_message_for_should:
|
38
|
-
failure_message_for_should_not:
|
37
|
+
failure_message_for_should: '%{model} should ensure valid alpha format of attribute %{attr}'
|
38
|
+
failure_message_for_should_not: '%{model} should not ensure valid alpha format of attribute %{attr}'
|
39
39
|
ensure_valid_alpha_numeric_format_of:
|
40
|
-
failure_message_for_should:
|
41
|
-
failure_message_for_should_not:
|
40
|
+
failure_message_for_should: '%{model} should ensure valid alpha numeric format of attribute %{attr}'
|
41
|
+
failure_message_for_should_not: '%{model} should not ensure valid alpha numeric format of attribute %{attr}'
|
42
42
|
ensure_valid_base64_format_of:
|
43
|
-
failure_message_for_should:
|
44
|
-
failure_message_for_should_not:
|
43
|
+
failure_message_for_should: '%{model} should ensure valid Base64 encoded format of attribute %{attr}'
|
44
|
+
failure_message_for_should_not: '%{model} should not ensure valid Base64 encoded format of attribute %{attr}'
|
45
45
|
ensure_valid_boolean_format_of:
|
46
|
-
failure_message_for_should:
|
47
|
-
failure_message_for_should_not:
|
46
|
+
failure_message_for_should: '%{model} should ensure valid boolean format of attribute %{attr}'
|
47
|
+
failure_message_for_should_not: '%{model} should not ensure valid boolean format of attribute %{attr}'
|
48
48
|
ensure_valid_coordinate_format_of:
|
49
|
-
failure_message_for_should:
|
50
|
-
failure_message_for_should_not:
|
49
|
+
failure_message_for_should: '%{model} should ensure valid coordinate format of attribute %{attr}'
|
50
|
+
failure_message_for_should_not: '%{model} should not ensure valid coordinate format of attribute %{attr}'
|
51
51
|
ensure_valid_credit_card_format_of:
|
52
|
-
failure_message_for_should:
|
53
|
-
failure_message_for_should_not:
|
52
|
+
failure_message_for_should: '%{model} should ensure valid credit card format of attribute %{attr}'
|
53
|
+
failure_message_for_should_not: '%{model} should not ensure valid credit card format of attribute %{attr}'
|
54
54
|
ensure_valid_currency_format_of:
|
55
|
-
failure_message_for_should:
|
56
|
-
failure_message_for_should_not:
|
55
|
+
failure_message_for_should: '%{model} should ensure valid currency format of attribute %{attr}'
|
56
|
+
failure_message_for_should_not: '%{model} should not ensure valid currency format of attribute %{attr}'
|
57
57
|
ensure_valid_cusip_format_of:
|
58
|
-
failure_message_for_should:
|
59
|
-
failure_message_for_should_not:
|
58
|
+
failure_message_for_should: '%{model} should ensure valid CUSIP format of attribute %{attr}'
|
59
|
+
failure_message_for_should_not: '%{model} should not ensure valid CUSIP format of attribute %{attr}'
|
60
60
|
ensure_valid_email_format_of:
|
61
|
-
failure_message_for_should:
|
62
|
-
failure_message_for_should_not:
|
61
|
+
failure_message_for_should: '%{model} should ensure valid email format of attribute %{attr}'
|
62
|
+
failure_message_for_should_not: '%{model} should not ensure valid email format of attribute %{attr}'
|
63
63
|
ensure_valid_equality_format_of:
|
64
|
-
failure_message_for_should:
|
65
|
-
failure_message_for_should_not:
|
64
|
+
failure_message_for_should: '%{model} should ensure equality of %{operator} on attribute %{attr}'
|
65
|
+
failure_message_for_should_not: '%{model} should not ensure equality of %{operator} on attribute %{attr}'
|
66
66
|
ensure_valid_hex_format_of:
|
67
|
-
failure_message_for_should:
|
68
|
-
failure_message_for_should_not:
|
67
|
+
failure_message_for_should: '%{model} should ensure valid hex format of attribute %{attr}'
|
68
|
+
failure_message_for_should_not: '%{model} should not ensure valid hex format of attribute %{attr}'
|
69
69
|
ensure_valid_imei_format_of:
|
70
|
-
failure_message_for_should:
|
71
|
-
failure_message_for_should_not:
|
70
|
+
failure_message_for_should: '%{model} should ensure valid IMEI address format of attribute %{attr}'
|
71
|
+
failure_message_for_should_not: '%{model} should not ensure valid IMEI address format of attribute %{attr}'
|
72
72
|
ensure_valid_ip_format_of:
|
73
|
-
failure_message_for_should:
|
74
|
-
failure_message_for_should_not:
|
73
|
+
failure_message_for_should: '%{model} should ensure valid IP address format of attribute %{attr}'
|
74
|
+
failure_message_for_should_not: '%{model} should not ensure valid IP address format of attribute %{attr}'
|
75
75
|
ensure_valid_isbn_format_of:
|
76
|
-
failure_message_for_should:
|
77
|
-
failure_message_for_should_not:
|
76
|
+
failure_message_for_should: '%{model} should ensure valid ISBN format of attribute %{attr}'
|
77
|
+
failure_message_for_should_not: '%{model} should not ensure valid ISBN format of attribute %{attr}'
|
78
78
|
ensure_valid_isin_format_of:
|
79
|
-
failure_message_for_should:
|
80
|
-
failure_message_for_should_not:
|
79
|
+
failure_message_for_should: '%{model} should ensure valid ISIN format of attribute %{attr}'
|
80
|
+
failure_message_for_should_not: '%{model} should not ensure valid ISIN format of attribute %{attr}'
|
81
81
|
ensure_valid_mac_address_format_of:
|
82
|
-
failure_message_for_should:
|
83
|
-
failure_message_for_should_not:
|
82
|
+
failure_message_for_should: '%{model} should ensure valid MAC address format of attribute %{attr}'
|
83
|
+
failure_message_for_should_not: '%{model} should not ensure valid MAC address format of attribute %{attr}'
|
84
84
|
ensure_valid_name_format_of:
|
85
|
-
failure_message_for_should:
|
86
|
-
failure_message_for_should_not:
|
85
|
+
failure_message_for_should: '%{model} should ensure valid name format of attribute %{attr}'
|
86
|
+
failure_message_for_should_not: '%{model} should not ensure valid name format of attribute %{attr}'
|
87
87
|
ensure_valid_password_format_of:
|
88
|
-
failure_message_for_should:
|
89
|
-
failure_message_for_should_not:
|
88
|
+
failure_message_for_should: '%{model} should ensure valid password format of attribute %{attr}'
|
89
|
+
failure_message_for_should_not: '%{model} should not ensure valid password format of attribute %{attr}'
|
90
90
|
ensure_valid_phone_format_of:
|
91
|
-
failure_message_for_should:
|
92
|
-
failure_message_for_should_not:
|
91
|
+
failure_message_for_should: '%{model} should ensure valid phone format of attribute %{attr}'
|
92
|
+
failure_message_for_should_not: '%{model} should not ensure valid phone format of attribute %{attr}'
|
93
93
|
ensure_valid_sedol_format_of:
|
94
|
-
failure_message_for_should:
|
95
|
-
failure_message_for_should_not:
|
94
|
+
failure_message_for_should: '%{model} should ensure valid SEDOL format of attribute %{attr}'
|
95
|
+
failure_message_for_should_not: '%{model} should not ensure valid SEDOL format of attribute %{attr}'
|
96
96
|
ensure_valid_slug_format_of:
|
97
|
-
failure_message_for_should:
|
98
|
-
failure_message_for_should_not:
|
97
|
+
failure_message_for_should: '%{model} should ensure valid slug format of attribute %{attr}'
|
98
|
+
failure_message_for_should_not: '%{model} should not ensure valid slug format of attribute %{attr}'
|
99
99
|
ensure_valid_ssn_format_of:
|
100
|
-
failure_message_for_should:
|
101
|
-
failure_message_for_should_not:
|
100
|
+
failure_message_for_should: '%{model} should ensure valid SSN format of attribute %{attr}'
|
101
|
+
failure_message_for_should_not: '%{model} should not ensure valid SSN format of attribute %{attr}'
|
102
102
|
ensure_valid_tracking_number_format_of:
|
103
|
-
failure_message_for_should:
|
104
|
-
failure_message_for_should_not:
|
103
|
+
failure_message_for_should: '%{model} should ensure valid tracking number format of attribute %{attr}'
|
104
|
+
failure_message_for_should_not: '%{model} should not ensure valid tracking number format of attribute %{attr}'
|
105
105
|
ensure_valid_type_format_of:
|
106
|
-
failure_message_for_should:
|
107
|
-
failure_message_for_should_not:
|
106
|
+
failure_message_for_should: '%{model} should ensure valid type of attribute %{attr}'
|
107
|
+
failure_message_for_should_not: '%{model} should not ensure valid type of attribute %{attr}'
|
108
108
|
ensure_valid_url_format_of:
|
109
|
-
failure_message_for_should:
|
110
|
-
failure_message_for_should_not:
|
109
|
+
failure_message_for_should: '%{model} should ensure valid URL format of attribute %{attr}'
|
110
|
+
failure_message_for_should_not: '%{model} should not ensure valid URL format of attribute %{attr}'
|
111
111
|
ensure_valid_username_format_of:
|
112
|
-
failure_message_for_should:
|
113
|
-
failure_message_for_should_not:
|
112
|
+
failure_message_for_should: '%{model} should ensure valid username format of attribute %{attr}'
|
113
|
+
failure_message_for_should_not: '%{model} should not ensure valid username format of attribute %{attr}'
|
114
114
|
ensure_valid_uuid_format_of:
|
115
|
-
failure_message_for_should:
|
116
|
-
failure_message_for_should_not:
|
115
|
+
failure_message_for_should: '%{model} should ensure valid UUID format of attribute %{attr}'
|
116
|
+
failure_message_for_should_not: '%{model} should not ensure valid UUID format of attribute %{attr}'
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/active_validation.rb
CHANGED
@@ -1,86 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require "active_validation/version"
|
1
|
+
require 'active_model'
|
2
|
+
require 'active_support'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
require "active_validation
|
8
|
-
|
9
|
-
require "active_validation/validators/coordinate_validator"
|
10
|
-
require "active_validation/validators/credit_card_validator"
|
11
|
-
require "active_validation/validators/currency_validator"
|
12
|
-
require "active_validation/validators/cusip_validator"
|
13
|
-
require "active_validation/validators/email_validator"
|
14
|
-
require "active_validation/validators/equality_validator"
|
15
|
-
require "active_validation/validators/hex_validator"
|
16
|
-
require "active_validation/validators/imei_validator"
|
17
|
-
require "active_validation/validators/ip_validator"
|
18
|
-
require "active_validation/validators/isbn_validator"
|
19
|
-
require "active_validation/validators/isin_validator"
|
20
|
-
require "active_validation/validators/mac_address_validator"
|
21
|
-
require "active_validation/validators/name_validator"
|
22
|
-
require "active_validation/validators/password_validator"
|
23
|
-
require "active_validation/validators/phone_validator"
|
24
|
-
require "active_validation/validators/sedol_validator"
|
25
|
-
require "active_validation/validators/slug_validator"
|
26
|
-
require "active_validation/validators/ssn_validator"
|
27
|
-
require "active_validation/validators/tracking_number_validator"
|
28
|
-
require "active_validation/validators/type_validator"
|
29
|
-
require "active_validation/validators/url_validator"
|
30
|
-
require "active_validation/validators/username_validator"
|
31
|
-
require "active_validation/validators/uuid_validator"
|
32
|
-
|
33
|
-
if defined?(RSpec)
|
34
|
-
require "rspec/matchers"
|
35
|
-
require "active_validation/matchers/ensure_valid_alpha_format_of"
|
36
|
-
require "active_validation/matchers/ensure_valid_alpha_numeric_format_of"
|
37
|
-
require "active_validation/matchers/ensure_valid_base64_format_of"
|
38
|
-
require "active_validation/matchers/ensure_valid_boolean_format_of"
|
39
|
-
require "active_validation/matchers/ensure_valid_coordinate_format_of"
|
40
|
-
require "active_validation/matchers/ensure_valid_credit_card_format_of"
|
41
|
-
require "active_validation/matchers/ensure_valid_currency_format_of"
|
42
|
-
require "active_validation/matchers/ensure_valid_cusip_format_of"
|
43
|
-
require "active_validation/matchers/ensure_valid_email_format_of"
|
44
|
-
require "active_validation/matchers/ensure_valid_equality_matcher_of"
|
45
|
-
require "active_validation/matchers/ensure_valid_hex_format_of"
|
46
|
-
require "active_validation/matchers/ensure_valid_imei_format_of"
|
47
|
-
require "active_validation/matchers/ensure_valid_ip_format_of"
|
48
|
-
require "active_validation/matchers/ensure_valid_isbn_format_of"
|
49
|
-
require "active_validation/matchers/ensure_valid_isin_format_of"
|
50
|
-
require "active_validation/matchers/ensure_valid_mac_address_format_of"
|
51
|
-
require "active_validation/matchers/ensure_valid_name_format_of"
|
52
|
-
require "active_validation/matchers/ensure_valid_password_format_of"
|
53
|
-
require "active_validation/matchers/ensure_valid_phone_format_of"
|
54
|
-
require "active_validation/matchers/ensure_valid_sedol_format_of"
|
55
|
-
require "active_validation/matchers/ensure_valid_slug_format_of"
|
56
|
-
require "active_validation/matchers/ensure_valid_ssn_format_of"
|
57
|
-
require "active_validation/matchers/ensure_valid_tracking_number_format_of"
|
58
|
-
require "active_validation/matchers/ensure_valid_type_format_of"
|
59
|
-
require "active_validation/matchers/ensure_valid_url_format_of"
|
60
|
-
require "active_validation/matchers/ensure_valid_username_format_of"
|
61
|
-
require "active_validation/matchers/ensure_valid_uuid_format_of"
|
62
|
-
end
|
63
|
-
|
64
|
-
if defined?(Rails)
|
65
|
-
require "rails"
|
66
|
-
|
67
|
-
module ActiveValidation
|
68
|
-
class Railtie < ::Rails::Railtie
|
69
|
-
|
70
|
-
initializer "active_validation" do |app|
|
71
|
-
ActiveValidation::Railtie.instance_eval do
|
72
|
-
[app.config.i18n.available_locales].flatten.each do |locale|
|
73
|
-
(I18n.load_path << path(locale)) if File.file?(path(locale))
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
protected
|
79
|
-
|
80
|
-
def self.path(locale)
|
81
|
-
File.expand_path("../../config/locales/#{locale}.yml", __FILE__)
|
82
|
-
end
|
4
|
+
%w(version railtie)
|
5
|
+
.each do |file_name|
|
6
|
+
require "active_validation/#{file_name}"
|
7
|
+
end
|
83
8
|
|
84
|
-
|
9
|
+
%w(
|
10
|
+
alpha alpha_numeric base64 boolean coordinate credit_card currency cusip email equality hex imei
|
11
|
+
ip isbn isin mac_address name password phone sedol slug ssn tracking_number type url username uuid
|
12
|
+
)
|
13
|
+
.each do |file_name|
|
14
|
+
require "active_validation/validators/#{file_name}_validator"
|
85
15
|
end
|
86
|
-
end
|