activemodel 6.0.0 → 6.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/active_model/gem_version.rb +2 -2
- data/lib/active_model/validations/acceptance.rb +26 -21
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 730f70f2562e4ec51447fabe473bb6e47a34c51224db9b987559d5684943560f
|
4
|
+
data.tar.gz: 2f480664d22d4c09bb1c0d1247b1cc94b2ae69d3c876507c6b3e0e4d39adb1ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 610908012ccc1e598efea402bee3d63edbe0a558324673c1670b8d310928a298fdad1e206442ab6d018c0057565d8a93051013b7037e7fffbfbbf1bf95bfcbef
|
7
|
+
data.tar.gz: 2e2fd041d8054a208bcddfd0b5731874f1f80bdaf69e7885960fef5f992432a9b5c1741605450152602c31c8002a87850e7e4c8b069de34f0e565231dd4921c7
|
data/CHANGELOG.md
CHANGED
@@ -17,7 +17,8 @@ module ActiveModel
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def setup!(klass)
|
20
|
-
|
20
|
+
define_attributes = LazilyDefineAttributes.new(attributes)
|
21
|
+
klass.include(define_attributes) unless klass.included_modules.include?(define_attributes)
|
21
22
|
end
|
22
23
|
|
23
24
|
def acceptable_option?(value)
|
@@ -25,46 +26,50 @@ module ActiveModel
|
|
25
26
|
end
|
26
27
|
|
27
28
|
class LazilyDefineAttributes < Module
|
28
|
-
def initialize(
|
29
|
+
def initialize(attributes)
|
30
|
+
@attributes = attributes.map(&:to_s)
|
31
|
+
end
|
32
|
+
|
33
|
+
def included(klass)
|
34
|
+
mod = self
|
35
|
+
|
29
36
|
define_method(:respond_to_missing?) do |method_name, include_private = false|
|
30
|
-
|
37
|
+
mod.define_on(klass)
|
38
|
+
super(method_name, include_private) || mod.matches?(method_name)
|
31
39
|
end
|
32
40
|
|
33
41
|
define_method(:method_missing) do |method_name, *args, &block|
|
34
|
-
|
35
|
-
|
42
|
+
mod.define_on(klass)
|
43
|
+
if mod.matches?(method_name)
|
36
44
|
send(method_name, *args, &block)
|
37
45
|
else
|
38
46
|
super(method_name, *args, &block)
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
42
|
-
end
|
43
|
-
|
44
|
-
class AttributeDefinition
|
45
|
-
def initialize(attributes)
|
46
|
-
@attributes = attributes.map(&:to_s)
|
47
|
-
end
|
48
50
|
|
49
51
|
def matches?(method_name)
|
50
|
-
attr_name =
|
51
|
-
attributes.
|
52
|
+
attr_name = method_name.to_s.chomp("=")
|
53
|
+
attributes.any? { |name| name == attr_name }
|
52
54
|
end
|
53
55
|
|
54
56
|
def define_on(klass)
|
57
|
+
remove_method :respond_to_missing?
|
58
|
+
remove_method :method_missing
|
59
|
+
|
55
60
|
attr_readers = attributes.reject { |name| klass.attribute_method?(name) }
|
56
61
|
attr_writers = attributes.reject { |name| klass.attribute_method?("#{name}=") }
|
57
|
-
|
58
|
-
|
59
|
-
|
62
|
+
|
63
|
+
attr_reader(*attr_readers)
|
64
|
+
attr_writer(*attr_writers)
|
60
65
|
end
|
61
66
|
|
62
|
-
|
63
|
-
|
67
|
+
def ==(other)
|
68
|
+
self.class == other.class && attributes == other.attributes
|
69
|
+
end
|
64
70
|
|
65
|
-
|
66
|
-
|
67
|
-
end
|
71
|
+
protected
|
72
|
+
attr_reader :attributes
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
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: 6.0.
|
4
|
+
version: 6.0.1.rc1
|
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-
|
11
|
+
date: 2019-10-31 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: 6.0.
|
19
|
+
version: 6.0.1.rc1
|
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: 6.0.
|
26
|
+
version: 6.0.1.rc1
|
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.
|
@@ -101,8 +101,11 @@ homepage: https://rubyonrails.org
|
|
101
101
|
licenses:
|
102
102
|
- MIT
|
103
103
|
metadata:
|
104
|
-
|
105
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.
|
104
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
105
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.1.rc1/activemodel/CHANGELOG.md
|
106
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.1.rc1/
|
107
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
|
108
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.1.rc1/activemodel
|
106
109
|
post_install_message:
|
107
110
|
rdoc_options: []
|
108
111
|
require_paths:
|
@@ -114,11 +117,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
117
|
version: 2.5.0
|
115
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
119
|
requirements:
|
117
|
-
- - "
|
120
|
+
- - ">"
|
118
121
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
122
|
+
version: 1.3.1
|
120
123
|
requirements: []
|
121
|
-
rubygems_version: 3.0.
|
124
|
+
rubygems_version: 3.0.3
|
122
125
|
signing_key:
|
123
126
|
specification_version: 4
|
124
127
|
summary: A toolkit for building modeling frameworks (part of Rails).
|