omg-activemodel 8.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +67 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.rdoc +266 -0
  5. data/lib/active_model/access.rb +16 -0
  6. data/lib/active_model/api.rb +99 -0
  7. data/lib/active_model/attribute/user_provided_default.rb +55 -0
  8. data/lib/active_model/attribute.rb +277 -0
  9. data/lib/active_model/attribute_assignment.rb +78 -0
  10. data/lib/active_model/attribute_methods.rb +592 -0
  11. data/lib/active_model/attribute_mutation_tracker.rb +189 -0
  12. data/lib/active_model/attribute_registration.rb +117 -0
  13. data/lib/active_model/attribute_set/builder.rb +182 -0
  14. data/lib/active_model/attribute_set/yaml_encoder.rb +40 -0
  15. data/lib/active_model/attribute_set.rb +118 -0
  16. data/lib/active_model/attributes.rb +165 -0
  17. data/lib/active_model/callbacks.rb +155 -0
  18. data/lib/active_model/conversion.rb +121 -0
  19. data/lib/active_model/deprecator.rb +7 -0
  20. data/lib/active_model/dirty.rb +416 -0
  21. data/lib/active_model/error.rb +208 -0
  22. data/lib/active_model/errors.rb +547 -0
  23. data/lib/active_model/forbidden_attributes_protection.rb +33 -0
  24. data/lib/active_model/gem_version.rb +17 -0
  25. data/lib/active_model/lint.rb +118 -0
  26. data/lib/active_model/locale/en.yml +38 -0
  27. data/lib/active_model/model.rb +78 -0
  28. data/lib/active_model/naming.rb +359 -0
  29. data/lib/active_model/nested_error.rb +22 -0
  30. data/lib/active_model/railtie.rb +24 -0
  31. data/lib/active_model/secure_password.rb +231 -0
  32. data/lib/active_model/serialization.rb +198 -0
  33. data/lib/active_model/serializers/json.rb +154 -0
  34. data/lib/active_model/translation.rb +78 -0
  35. data/lib/active_model/type/big_integer.rb +36 -0
  36. data/lib/active_model/type/binary.rb +62 -0
  37. data/lib/active_model/type/boolean.rb +48 -0
  38. data/lib/active_model/type/date.rb +78 -0
  39. data/lib/active_model/type/date_time.rb +88 -0
  40. data/lib/active_model/type/decimal.rb +107 -0
  41. data/lib/active_model/type/float.rb +64 -0
  42. data/lib/active_model/type/helpers/accepts_multiparameter_time.rb +53 -0
  43. data/lib/active_model/type/helpers/mutable.rb +24 -0
  44. data/lib/active_model/type/helpers/numeric.rb +61 -0
  45. data/lib/active_model/type/helpers/time_value.rb +127 -0
  46. data/lib/active_model/type/helpers/timezone.rb +23 -0
  47. data/lib/active_model/type/helpers.rb +7 -0
  48. data/lib/active_model/type/immutable_string.rb +71 -0
  49. data/lib/active_model/type/integer.rb +113 -0
  50. data/lib/active_model/type/registry.rb +37 -0
  51. data/lib/active_model/type/serialize_cast_value.rb +47 -0
  52. data/lib/active_model/type/string.rb +43 -0
  53. data/lib/active_model/type/time.rb +87 -0
  54. data/lib/active_model/type/value.rb +157 -0
  55. data/lib/active_model/type.rb +55 -0
  56. data/lib/active_model/validations/absence.rb +33 -0
  57. data/lib/active_model/validations/acceptance.rb +113 -0
  58. data/lib/active_model/validations/callbacks.rb +119 -0
  59. data/lib/active_model/validations/clusivity.rb +54 -0
  60. data/lib/active_model/validations/comparability.rb +18 -0
  61. data/lib/active_model/validations/comparison.rb +90 -0
  62. data/lib/active_model/validations/confirmation.rb +80 -0
  63. data/lib/active_model/validations/exclusion.rb +49 -0
  64. data/lib/active_model/validations/format.rb +112 -0
  65. data/lib/active_model/validations/helper_methods.rb +15 -0
  66. data/lib/active_model/validations/inclusion.rb +47 -0
  67. data/lib/active_model/validations/length.rb +130 -0
  68. data/lib/active_model/validations/numericality.rb +222 -0
  69. data/lib/active_model/validations/presence.rb +39 -0
  70. data/lib/active_model/validations/resolve_value.rb +26 -0
  71. data/lib/active_model/validations/validates.rb +175 -0
  72. data/lib/active_model/validations/with.rb +154 -0
  73. data/lib/active_model/validations.rb +489 -0
  74. data/lib/active_model/validator.rb +190 -0
  75. data/lib/active_model/version.rb +10 -0
  76. data/lib/active_model.rb +84 -0
  77. metadata +139 -0
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright (c) David Heinemeier Hansson
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ #++
25
+
26
+ require "active_support"
27
+ require "active_support/rails"
28
+ require "active_model/version"
29
+ require "active_model/deprecator"
30
+
31
+ # :include: ../README.rdoc
32
+ module ActiveModel
33
+ extend ActiveSupport::Autoload
34
+
35
+ autoload :Access
36
+ autoload :API
37
+ autoload :Attribute
38
+ autoload :Attributes
39
+ autoload :AttributeAssignment
40
+ autoload :AttributeMethods
41
+ autoload :AttributeRegistration
42
+ autoload :BlockValidator, "active_model/validator"
43
+ autoload :Callbacks
44
+ autoload :Conversion
45
+ autoload :Dirty
46
+ autoload :EachValidator, "active_model/validator"
47
+ autoload :ForbiddenAttributesProtection
48
+ autoload :Lint
49
+ autoload :Model
50
+ autoload :Name, "active_model/naming"
51
+ autoload :Naming
52
+ autoload :SecurePassword
53
+ autoload :Serialization
54
+ autoload :Translation
55
+ autoload :Type
56
+ autoload :Validations
57
+ autoload :Validator
58
+
59
+ eager_autoload do
60
+ autoload :Errors
61
+ autoload :Error
62
+ autoload :RangeError, "active_model/errors"
63
+ autoload :StrictValidationFailed, "active_model/errors"
64
+ autoload :UnknownAttributeError, "active_model/errors"
65
+ autoload :ValidationError, "active_model/validations"
66
+ end
67
+
68
+ module Serializers
69
+ extend ActiveSupport::Autoload
70
+
71
+ eager_autoload do
72
+ autoload :JSON
73
+ end
74
+ end
75
+
76
+ def self.eager_load!
77
+ super
78
+ ActiveModel::Serializers.eager_load!
79
+ end
80
+ end
81
+
82
+ ActiveSupport.on_load(:i18n) do
83
+ I18n.load_path << File.expand_path("active_model/locale/en.yml", __dir__)
84
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omg-activemodel
3
+ version: !ruby/object:Gem::Version
4
+ version: 8.0.0.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - David Heinemeier Hansson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omg-activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 8.0.0.alpha1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 8.0.0.alpha1
27
+ description: A toolkit for building modeling frameworks like Active Record. Rich support
28
+ for attributes, callbacks, validations, serialization, internationalization, and
29
+ testing.
30
+ email: david@loudthinking.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - CHANGELOG.md
36
+ - MIT-LICENSE
37
+ - README.rdoc
38
+ - lib/active_model.rb
39
+ - lib/active_model/access.rb
40
+ - lib/active_model/api.rb
41
+ - lib/active_model/attribute.rb
42
+ - lib/active_model/attribute/user_provided_default.rb
43
+ - lib/active_model/attribute_assignment.rb
44
+ - lib/active_model/attribute_methods.rb
45
+ - lib/active_model/attribute_mutation_tracker.rb
46
+ - lib/active_model/attribute_registration.rb
47
+ - lib/active_model/attribute_set.rb
48
+ - lib/active_model/attribute_set/builder.rb
49
+ - lib/active_model/attribute_set/yaml_encoder.rb
50
+ - lib/active_model/attributes.rb
51
+ - lib/active_model/callbacks.rb
52
+ - lib/active_model/conversion.rb
53
+ - lib/active_model/deprecator.rb
54
+ - lib/active_model/dirty.rb
55
+ - lib/active_model/error.rb
56
+ - lib/active_model/errors.rb
57
+ - lib/active_model/forbidden_attributes_protection.rb
58
+ - lib/active_model/gem_version.rb
59
+ - lib/active_model/lint.rb
60
+ - lib/active_model/locale/en.yml
61
+ - lib/active_model/model.rb
62
+ - lib/active_model/naming.rb
63
+ - lib/active_model/nested_error.rb
64
+ - lib/active_model/railtie.rb
65
+ - lib/active_model/secure_password.rb
66
+ - lib/active_model/serialization.rb
67
+ - lib/active_model/serializers/json.rb
68
+ - lib/active_model/translation.rb
69
+ - lib/active_model/type.rb
70
+ - lib/active_model/type/big_integer.rb
71
+ - lib/active_model/type/binary.rb
72
+ - lib/active_model/type/boolean.rb
73
+ - lib/active_model/type/date.rb
74
+ - lib/active_model/type/date_time.rb
75
+ - lib/active_model/type/decimal.rb
76
+ - lib/active_model/type/float.rb
77
+ - lib/active_model/type/helpers.rb
78
+ - lib/active_model/type/helpers/accepts_multiparameter_time.rb
79
+ - lib/active_model/type/helpers/mutable.rb
80
+ - lib/active_model/type/helpers/numeric.rb
81
+ - lib/active_model/type/helpers/time_value.rb
82
+ - lib/active_model/type/helpers/timezone.rb
83
+ - lib/active_model/type/immutable_string.rb
84
+ - lib/active_model/type/integer.rb
85
+ - lib/active_model/type/registry.rb
86
+ - lib/active_model/type/serialize_cast_value.rb
87
+ - lib/active_model/type/string.rb
88
+ - lib/active_model/type/time.rb
89
+ - lib/active_model/type/value.rb
90
+ - lib/active_model/validations.rb
91
+ - lib/active_model/validations/absence.rb
92
+ - lib/active_model/validations/acceptance.rb
93
+ - lib/active_model/validations/callbacks.rb
94
+ - lib/active_model/validations/clusivity.rb
95
+ - lib/active_model/validations/comparability.rb
96
+ - lib/active_model/validations/comparison.rb
97
+ - lib/active_model/validations/confirmation.rb
98
+ - lib/active_model/validations/exclusion.rb
99
+ - lib/active_model/validations/format.rb
100
+ - lib/active_model/validations/helper_methods.rb
101
+ - lib/active_model/validations/inclusion.rb
102
+ - lib/active_model/validations/length.rb
103
+ - lib/active_model/validations/numericality.rb
104
+ - lib/active_model/validations/presence.rb
105
+ - lib/active_model/validations/resolve_value.rb
106
+ - lib/active_model/validations/validates.rb
107
+ - lib/active_model/validations/with.rb
108
+ - lib/active_model/validator.rb
109
+ - lib/active_model/version.rb
110
+ homepage: https://rubyonrails.org
111
+ licenses:
112
+ - MIT
113
+ metadata:
114
+ bug_tracker_uri: https://github.com/rails/rails/issues
115
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.alpha1/activemodel/CHANGELOG.md
116
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.alpha1/
117
+ mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
118
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.alpha1/activemodel
119
+ rubygems_mfa_required: 'true'
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 3.1.0
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubygems_version: 3.5.11
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: A toolkit for building modeling frameworks (part of Rails).
139
+ test_files: []