active_validation 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.fasterer.yml +19 -0
  4. data/.reek +36 -0
  5. data/.rubocop.yml +54 -0
  6. data/Gemfile +1 -1
  7. data/Rakefile +1 -1
  8. data/active_validation.gemspec +21 -18
  9. data/bin/console +4 -4
  10. data/bin/rake +6 -7
  11. data/config/locales/en.yml +83 -83
  12. data/lib/.DS_Store +0 -0
  13. data/lib/active_validation.rb +12 -83
  14. data/lib/active_validation/.DS_Store +0 -0
  15. data/lib/active_validation/railtie.rb +19 -0
  16. data/lib/active_validation/validators/alpha_numeric_validator.rb +11 -10
  17. data/lib/active_validation/validators/alpha_validator.rb +11 -10
  18. data/lib/active_validation/validators/base64_validator.rb +2 -1
  19. data/lib/active_validation/validators/boolean_validator.rb +4 -6
  20. data/lib/active_validation/validators/coordinate_validator.rb +8 -5
  21. data/lib/active_validation/validators/credit_card_validator.rb +35 -36
  22. data/lib/active_validation/validators/currency_validator.rb +3 -2
  23. data/lib/active_validation/validators/cusip_validator.rb +9 -6
  24. data/lib/active_validation/validators/email_validator.rb +4 -3
  25. data/lib/active_validation/validators/equality_validator.rb +14 -13
  26. data/lib/active_validation/validators/hex_validator.rb +2 -1
  27. data/lib/active_validation/validators/imei_validator.rb +7 -6
  28. data/lib/active_validation/validators/ip_validator.rb +4 -1
  29. data/lib/active_validation/validators/isbn_validator.rb +5 -4
  30. data/lib/active_validation/validators/isin_validator.rb +12 -9
  31. data/lib/active_validation/validators/mac_address_validator.rb +7 -3
  32. data/lib/active_validation/validators/name_validator.rb +3 -2
  33. data/lib/active_validation/validators/password_validator.rb +7 -2
  34. data/lib/active_validation/validators/phone_validator.rb +3 -2
  35. data/lib/active_validation/validators/sedol_validator.rb +4 -3
  36. data/lib/active_validation/validators/slug_validator.rb +2 -1
  37. data/lib/active_validation/validators/ssn_validator.rb +2 -1
  38. data/lib/active_validation/validators/tracking_number_validator.rb +73 -68
  39. data/lib/active_validation/validators/type_validator.rb +3 -2
  40. data/lib/active_validation/validators/url_validator.rb +12 -11
  41. data/lib/active_validation/validators/username_validator.rb +2 -1
  42. data/lib/active_validation/validators/uuid_validator.rb +12 -11
  43. data/lib/active_validation/version.rb +1 -1
  44. metadata +51 -29
  45. data/lib/active_validation/matchers/ensure_valid_alpha_format_of.rb +0 -26
  46. data/lib/active_validation/matchers/ensure_valid_alpha_numeric_format_of.rb +0 -26
  47. data/lib/active_validation/matchers/ensure_valid_base64_format_of.rb +0 -26
  48. data/lib/active_validation/matchers/ensure_valid_boolean_format_of.rb +0 -26
  49. data/lib/active_validation/matchers/ensure_valid_coordinate_format_of.rb +0 -26
  50. data/lib/active_validation/matchers/ensure_valid_credit_card_format_of.rb +0 -26
  51. data/lib/active_validation/matchers/ensure_valid_currency_format_of.rb +0 -26
  52. data/lib/active_validation/matchers/ensure_valid_cusip_format_of.rb +0 -26
  53. data/lib/active_validation/matchers/ensure_valid_email_format_of.rb +0 -26
  54. data/lib/active_validation/matchers/ensure_valid_equality_matcher_of.rb +0 -40
  55. data/lib/active_validation/matchers/ensure_valid_hex_format_of.rb +0 -26
  56. data/lib/active_validation/matchers/ensure_valid_imei_format_of.rb +0 -26
  57. data/lib/active_validation/matchers/ensure_valid_ip_format_of.rb +0 -26
  58. data/lib/active_validation/matchers/ensure_valid_isbn_format_of.rb +0 -26
  59. data/lib/active_validation/matchers/ensure_valid_isin_format_of.rb +0 -26
  60. data/lib/active_validation/matchers/ensure_valid_mac_address_format_of.rb +0 -26
  61. data/lib/active_validation/matchers/ensure_valid_name_format_of.rb +0 -26
  62. data/lib/active_validation/matchers/ensure_valid_password_format_of.rb +0 -26
  63. data/lib/active_validation/matchers/ensure_valid_phone_format_of.rb +0 -26
  64. data/lib/active_validation/matchers/ensure_valid_sedol_format_of.rb +0 -26
  65. data/lib/active_validation/matchers/ensure_valid_slug_format_of.rb +0 -26
  66. data/lib/active_validation/matchers/ensure_valid_ssn_format_of.rb +0 -26
  67. data/lib/active_validation/matchers/ensure_valid_tracking_number_format_of.rb +0 -26
  68. data/lib/active_validation/matchers/ensure_valid_type_format_of.rb +0 -26
  69. data/lib/active_validation/matchers/ensure_valid_url_format_of.rb +0 -26
  70. data/lib/active_validation/matchers/ensure_valid_username_format_of.rb +0 -26
  71. 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: e8101533601a42b4554d36e1b2c4d6dddef6b24a
4
- data.tar.gz: 97f8fe9ad694de008834718099d07c2eb31fa8f7
3
+ metadata.gz: b83dbcd9c5139b1142d10c326acc7288074e7491
4
+ data.tar.gz: 284f00a5ce2cd119744ff459e8edfc284b39fa51
5
5
  SHA512:
6
- metadata.gz: fb2688046d3bca2af4a968c369d421a0c84de94b70432090263d933b3a5682b10c0f533751a5280c40d9723ad6a638fe25be6d6830925d992ba1025d75147508
7
- data.tar.gz: fb88e6eb295209133b247b76ebb459637130f03f6be33af535434e0653094bd96721571713de7b5bcd500ff18a6302a30cdfd6da9d59575a9cfe480c0c9589bc
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
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in active_validation.gemspec
4
4
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,3 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
 
3
3
  task default: :spec
@@ -1,30 +1,33 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+ lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "active_validation/version"
4
+ require 'active_validation/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "active_validation"
7
+ spec.name = 'active_validation'
8
8
  spec.version = ActiveValidation::VERSION
9
- spec.authors = ["Juan Gomez"]
10
- spec.email = ["j.gomez@drexed.com"]
9
+ spec.authors = ['Juan Gomez']
10
+ spec.email = ['j.gomez@drexed.com']
11
11
 
12
- spec.summary = %q{Gem for commonly used validators.}
13
- spec.description = %q{Validate commonly used attributes easily with ActiveValidation.}
14
- spec.homepage = "http://drexed.github.io/active_validation"
15
- spec.license = "MIT"
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 = "exe"
18
+ spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_runtime_dependency "activemodel"
23
- spec.add_runtime_dependency "activesupport"
22
+ spec.add_runtime_dependency 'activemodel'
23
+ spec.add_runtime_dependency 'activesupport'
24
24
 
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"
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 "bundler/setup"
4
- require "active_validation"
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 "pry"
10
+ # require 'pry'
11
11
  # Pry.start
12
12
 
13
- require "irb"
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 "rake" is installed as part of a gem, and
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 "pathname"
10
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath)
12
11
 
13
- require "rubygems"
14
- require "bundler/setup"
12
+ require 'rubygems'
13
+ require 'bundler/setup'
15
14
 
16
- load Gem.bin_path("rake", "rake")
15
+ load Gem.bin_path('rake', 'rake')
@@ -2,115 +2,115 @@ en:
2
2
  active_validation:
3
3
  errors:
4
4
  messages:
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"
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: "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"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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: "%{model} should ensure valid type of attribute %{attr}"
107
- failure_message_for_should_not: "%{model} should not ensure valid type of attribute %{attr}"
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: "%{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}"
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: "%{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}"
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: "%{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}"
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
@@ -1,86 +1,15 @@
1
- require "active_model"
2
- require "active_support"
3
- require "active_validation/version"
1
+ require 'active_model'
2
+ require 'active_support'
4
3
 
5
- require "active_validation/validators/alpha_validator"
6
- require "active_validation/validators/alpha_numeric_validator"
7
- require "active_validation/validators/base64_validator"
8
- require "active_validation/validators/boolean_validator"
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
- end
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