sql_enum 0.1.16 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -1
- data/Gemfile.lock +22 -23
- data/lib/active_record/connection_adapters/abstract_mysql.rb +1 -1
- data/lib/active_record/enum_override.rb +10 -3
- data/lib/sql_enum/version.rb +1 -1
- data/sql_enum.gemspec +2 -2
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dd16ecd7dbef436bf1613fa7b841e3575db7528778cee563fcb7128ae48ed24b
|
4
|
+
data.tar.gz: 474745a0a9090a1e9203493c6f4864a69fb07f622ece22e3db432142ef2de953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62b096819785f82af237b66cfe9cab150037e229796dda1e760f52e91140a8bcae092126e5bac5b0f51ea72cd25abad51ee9ad8f68b5ceb70b39682e18e367ce
|
7
|
+
data.tar.gz: 2c702f4de99f2c50513ae2b1cbcf17a349601d63b7e59a09750488358bca93632219924f444270a33befee9a28153970e0d129e1d20f62d30dc94ac028359d46
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sql_enum (0.
|
5
|
-
activerecord (
|
4
|
+
sql_enum (0.2.2)
|
5
|
+
activerecord (>= 5.0)
|
6
6
|
|
7
7
|
GEM
|
8
|
-
remote: https://
|
8
|
+
remote: https://gem-proxy.chime.com/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
|
16
|
-
activesupport (5.1.5)
|
10
|
+
activemodel (6.1.3.2)
|
11
|
+
activesupport (= 6.1.3.2)
|
12
|
+
activerecord (6.1.3.2)
|
13
|
+
activemodel (= 6.1.3.2)
|
14
|
+
activesupport (= 6.1.3.2)
|
15
|
+
activesupport (6.1.3.2)
|
17
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
-
i18n (
|
19
|
-
minitest (
|
20
|
-
tzinfo (~>
|
21
|
-
|
22
|
-
concurrent-ruby (1.
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
concurrent-ruby (1.1.8)
|
23
22
|
diff-lcs (1.3)
|
24
|
-
i18n (
|
23
|
+
i18n (1.8.10)
|
25
24
|
concurrent-ruby (~> 1.0)
|
26
|
-
minitest (5.
|
27
|
-
rake (
|
25
|
+
minitest (5.14.4)
|
26
|
+
rake (13.0.3)
|
28
27
|
rspec (3.7.0)
|
29
28
|
rspec-core (~> 3.7.0)
|
30
29
|
rspec-expectations (~> 3.7.0)
|
@@ -38,18 +37,18 @@ GEM
|
|
38
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
39
38
|
rspec-support (~> 3.7.0)
|
40
39
|
rspec-support (3.7.1)
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
tzinfo (2.0.4)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
zeitwerk (2.4.2)
|
44
43
|
|
45
44
|
PLATFORMS
|
46
45
|
ruby
|
47
46
|
|
48
47
|
DEPENDENCIES
|
49
48
|
bundler (~> 1.16)
|
50
|
-
rake (~>
|
49
|
+
rake (~> 13.0)
|
51
50
|
rspec (~> 3.0)
|
52
51
|
sql_enum!
|
53
52
|
|
54
53
|
BUNDLED WITH
|
55
|
-
1.
|
54
|
+
1.17.3
|
@@ -20,8 +20,15 @@ module ActiveRecord
|
|
20
20
|
detect_enum_conflict!(name, "#{name}=")
|
21
21
|
|
22
22
|
attr = attribute_alias?(name) ? attribute_alias(name) : name
|
23
|
-
|
24
|
-
|
23
|
+
|
24
|
+
if Rails.version >= '6.1'
|
25
|
+
decorate_attribute_type(name) do |subtype|
|
26
|
+
EnumType.new(attr, enum_values, subtype)
|
27
|
+
end
|
28
|
+
else
|
29
|
+
decorate_attribute_type(attr, :enum) do |subtype|
|
30
|
+
EnumType.new(attr, enum_values, subtype)
|
31
|
+
end
|
25
32
|
end
|
26
33
|
|
27
34
|
enum_values = values(name)
|
@@ -41,7 +48,7 @@ module ActiveRecord
|
|
41
48
|
|
42
49
|
# def active?() status == 0 end
|
43
50
|
klass.send(:detect_enum_conflict!, name, "#{value_method_name}?")
|
44
|
-
define_method("#{value_method_name}?") { self[attr] == value.
|
51
|
+
define_method("#{value_method_name}?") { self[attr] == value.to_sym }
|
45
52
|
|
46
53
|
# def active!() update! status: :active end
|
47
54
|
klass.send(:detect_enum_conflict!, name, "#{value_method_name}!")
|
data/lib/sql_enum/version.rb
CHANGED
data/sql_enum.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "activerecord"
|
23
|
+
spec.add_dependency "activerecord", ">= 5.0"
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.16"
|
25
|
-
spec.add_development_dependency "rake", "~>
|
25
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fletcher Fowler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '5.0'
|
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: '0'
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- fletch@fzf.me
|
72
72
|
executables: []
|
@@ -98,7 +98,7 @@ homepage: https://github.com/1debit/sql_enum
|
|
98
98
|
licenses:
|
99
99
|
- MIT
|
100
100
|
metadata: {}
|
101
|
-
post_install_message:
|
101
|
+
post_install_message:
|
102
102
|
rdoc_options: []
|
103
103
|
require_paths:
|
104
104
|
- lib
|
@@ -113,9 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
|
117
|
-
|
118
|
-
signing_key:
|
116
|
+
rubygems_version: 3.1.6
|
117
|
+
signing_key:
|
119
118
|
specification_version: 4
|
120
119
|
summary: Enable using native sql enums
|
121
120
|
test_files: []
|