activemodel 5.0.7.2 → 5.1.0.beta1

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.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +15 -219
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +1 -1
  5. data/lib/active_model.rb +11 -12
  6. data/lib/active_model/attribute_assignment.rb +11 -11
  7. data/lib/active_model/attribute_methods.rb +13 -15
  8. data/lib/active_model/callbacks.rb +19 -20
  9. data/lib/active_model/conversion.rb +12 -3
  10. data/lib/active_model/dirty.rb +14 -14
  11. data/lib/active_model/errors.rb +27 -103
  12. data/lib/active_model/forbidden_attributes_protection.rb +1 -1
  13. data/lib/active_model/gem_version.rb +3 -3
  14. data/lib/active_model/lint.rb +0 -1
  15. data/lib/active_model/model.rb +3 -4
  16. data/lib/active_model/naming.rb +9 -10
  17. data/lib/active_model/secure_password.rb +1 -1
  18. data/lib/active_model/serialization.rb +2 -2
  19. data/lib/active_model/serializers/json.rb +2 -2
  20. data/lib/active_model/translation.rb +2 -3
  21. data/lib/active_model/type.rb +15 -19
  22. data/lib/active_model/type/big_integer.rb +4 -4
  23. data/lib/active_model/type/binary.rb +1 -1
  24. data/lib/active_model/type/boolean.rb +20 -9
  25. data/lib/active_model/type/date.rb +25 -25
  26. data/lib/active_model/type/date_time.rb +21 -21
  27. data/lib/active_model/type/decimal.rb +35 -39
  28. data/lib/active_model/type/float.rb +17 -8
  29. data/lib/active_model/type/helpers.rb +4 -4
  30. data/lib/active_model/type/helpers/accepts_multiparameter_time.rb +2 -2
  31. data/lib/active_model/type/helpers/mutable.rb +2 -2
  32. data/lib/active_model/type/helpers/numeric.rb +18 -17
  33. data/lib/active_model/type/helpers/time_value.rb +23 -23
  34. data/lib/active_model/type/immutable_string.rb +9 -8
  35. data/lib/active_model/type/integer.rb +23 -21
  36. data/lib/active_model/type/registry.rb +12 -8
  37. data/lib/active_model/type/string.rb +1 -6
  38. data/lib/active_model/type/time.rb +15 -11
  39. data/lib/active_model/type/value.rb +6 -6
  40. data/lib/active_model/validations.rb +9 -12
  41. data/lib/active_model/validations/absence.rb +1 -1
  42. data/lib/active_model/validations/acceptance.rb +41 -40
  43. data/lib/active_model/validations/callbacks.rb +4 -7
  44. data/lib/active_model/validations/clusivity.rb +7 -7
  45. data/lib/active_model/validations/confirmation.rb +15 -16
  46. data/lib/active_model/validations/exclusion.rb +1 -2
  47. data/lib/active_model/validations/format.rb +24 -24
  48. data/lib/active_model/validations/inclusion.rb +1 -2
  49. data/lib/active_model/validations/length.rb +6 -42
  50. data/lib/active_model/validations/numericality.rb +3 -11
  51. data/lib/active_model/validations/presence.rb +1 -2
  52. data/lib/active_model/validations/validates.rb +6 -6
  53. data/lib/active_model/validations/with.rb +4 -2
  54. data/lib/active_model/validator.rb +5 -6
  55. data/lib/active_model/version.rb +1 -1
  56. metadata +8 -11
  57. data/lib/active_model/test_case.rb +0 -4
  58. data/lib/active_model/type/decimal_without_scale.rb +0 -11
  59. data/lib/active_model/type/text.rb +0 -11
  60. data/lib/active_model/type/unsigned_integer.rb +0 -15
@@ -1,7 +1,6 @@
1
1
  require "active_support/core_ext/module/anonymous"
2
2
 
3
3
  module ActiveModel
4
-
5
4
  # == Active \Model \Validator
6
5
  #
7
6
  # A simple base class that can be used along with
@@ -100,12 +99,12 @@ module ActiveModel
100
99
  # PresenceValidator.kind # => :presence
101
100
  # UniquenessValidator.kind # => :uniqueness
102
101
  def self.kind
103
- @kind ||= name.split('::').last.underscore.chomp('_validator').to_sym unless anonymous?
102
+ @kind ||= name.split("::").last.underscore.chomp("_validator").to_sym unless anonymous?
104
103
  end
105
104
 
106
105
  # Accepts options that will be made available through the +options+ reader.
107
106
  def initialize(options = {})
108
- @options = options.except(:class).freeze
107
+ @options = options.except(:class).freeze
109
108
  end
110
109
 
111
110
  # Returns the kind for this validator.
@@ -175,8 +174,8 @@ module ActiveModel
175
174
 
176
175
  private
177
176
 
178
- def validate_each(record, attribute, value)
179
- @block.call(record, attribute, value)
180
- end
177
+ def validate_each(record, attribute, value)
178
+ @block.call(record, attribute, value)
179
+ end
181
180
  end
182
181
  end
@@ -1,4 +1,4 @@
1
- require_relative 'gem_version'
1
+ require_relative "gem_version"
2
2
 
3
3
  module ActiveModel
4
4
  # Returns the version of the currently loaded \Active \Model as a <tt>Gem::Version</tt>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7.2
4
+ version: 5.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.7.2
19
+ version: 5.1.0.beta1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.7.2
26
+ version: 5.1.0.beta1
27
27
  description: A toolkit for building modeling frameworks like Active Record. Rich support
28
28
  for attributes, callbacks, validations, serialization, internationalization, and
29
29
  testing.
@@ -52,7 +52,6 @@ files:
52
52
  - lib/active_model/secure_password.rb
53
53
  - lib/active_model/serialization.rb
54
54
  - lib/active_model/serializers/json.rb
55
- - lib/active_model/test_case.rb
56
55
  - lib/active_model/translation.rb
57
56
  - lib/active_model/type.rb
58
57
  - lib/active_model/type/big_integer.rb
@@ -61,7 +60,6 @@ files:
61
60
  - lib/active_model/type/date.rb
62
61
  - lib/active_model/type/date_time.rb
63
62
  - lib/active_model/type/decimal.rb
64
- - lib/active_model/type/decimal_without_scale.rb
65
63
  - lib/active_model/type/float.rb
66
64
  - lib/active_model/type/helpers.rb
67
65
  - lib/active_model/type/helpers/accepts_multiparameter_time.rb
@@ -72,9 +70,7 @@ files:
72
70
  - lib/active_model/type/integer.rb
73
71
  - lib/active_model/type/registry.rb
74
72
  - lib/active_model/type/string.rb
75
- - lib/active_model/type/text.rb
76
73
  - lib/active_model/type/time.rb
77
- - lib/active_model/type/unsigned_integer.rb
78
74
  - lib/active_model/type/value.rb
79
75
  - lib/active_model/validations.rb
80
76
  - lib/active_model/validations/absence.rb
@@ -108,11 +104,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
104
  version: 2.2.2
109
105
  required_rubygems_version: !ruby/object:Gem::Requirement
110
106
  requirements:
111
- - - ">="
107
+ - - ">"
112
108
  - !ruby/object:Gem::Version
113
- version: '0'
109
+ version: 1.3.1
114
110
  requirements: []
115
- rubygems_version: 3.0.1
111
+ rubyforge_project:
112
+ rubygems_version: 2.6.10
116
113
  signing_key:
117
114
  specification_version: 4
118
115
  summary: A toolkit for building modeling frameworks (part of Rails).
@@ -1,4 +0,0 @@
1
- module ActiveModel #:nodoc:
2
- class TestCase < ActiveSupport::TestCase #:nodoc:
3
- end
4
- end
@@ -1,11 +0,0 @@
1
- require 'active_model/type/big_integer'
2
-
3
- module ActiveModel
4
- module Type
5
- class DecimalWithoutScale < BigInteger # :nodoc:
6
- def type
7
- :decimal
8
- end
9
- end
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- require 'active_model/type/string'
2
-
3
- module ActiveModel
4
- module Type
5
- class Text < String # :nodoc:
6
- def type
7
- :text
8
- end
9
- end
10
- end
11
- end
@@ -1,15 +0,0 @@
1
- module ActiveModel
2
- module Type
3
- class UnsignedInteger < Integer # :nodoc:
4
- private
5
-
6
- def max_value
7
- super * 2
8
- end
9
-
10
- def min_value
11
- 0
12
- end
13
- end
14
- end
15
- end