activerecord-not_nil 0.0.1 → 0.0.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cff53828664715b0ce21ca7339b820b7dfa739f7e96a15b7803f4f65dcf407a
|
4
|
+
data.tar.gz: aee88f25fde5b3bfded3a4196fe7c2b637888fb0e08bd881ffba952d19353ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992814f0c5161029088b43849940d9f9768e9382d24aaff79e09c16e519d7a59d81cca1395d848e73ef708f15277af615b31eb669ae34d9c6f21c102603c94bf
|
7
|
+
data.tar.gz: 69b6d7cf4fd24b146315d7851646bb12f46ae0d18b107bb008c6a69690b4697478bb933f5dd30ea2034d0423abd0c1c107f09882d7c26d31a9b9f5c80d235d18
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module ConnectionAdapters
|
5
|
+
module Quoting
|
6
|
+
alias origin_type_cast type_cast
|
7
|
+
def type_cast(value)
|
8
|
+
raise ArgumentError, 'Cannot assign not_nil as a value' if value.is_a?(::NotNilClass)
|
9
|
+
|
10
|
+
origin_type_cast(value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arel
|
4
|
+
module Visitors
|
5
|
+
# Module to override Arel::Visitors::ToSql#visit_Arel_Nodes_Equality
|
6
|
+
module NotNilOverride
|
7
|
+
def visit_Arel_Nodes_Equality(o, collector) # rubocop:disable Naming/MethodName
|
8
|
+
return super if o.right.is_a?(Arel::Attributes::Attribute)
|
9
|
+
return super if o.right.is_a?(Arel::Nodes::NamedFunction)
|
10
|
+
return super unless o.right.value.is_a?(::NotNilClass)
|
11
|
+
|
12
|
+
collector = visit o.left, collector
|
13
|
+
collector << ' IS NOT NULL'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ToSql < Arel::Visitors::Visitor
|
18
|
+
prepend NotNilOverride
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/activerecord-not_nil.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
require 'active_record'
|
5
5
|
require 'not_niller'
|
6
6
|
|
7
|
-
require_relative 'activerecord-not_nil/
|
7
|
+
require_relative 'activerecord-not_nil/active_record/connection_adapters/quoting'
|
8
8
|
require_relative 'activerecord-not_nil/arel/visitors/to_sql'
|
9
9
|
|
10
10
|
# rubocop:enable Naming/FileName
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-not_nil
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Payt devs
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -36,15 +36,15 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - '='
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.0.
|
39
|
+
version: 0.0.1
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - '='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.0.
|
47
|
-
description:
|
46
|
+
version: 0.0.1
|
47
|
+
description:
|
48
48
|
email:
|
49
49
|
- devs@paytsoftware.com
|
50
50
|
executables: []
|
@@ -52,11 +52,13 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- lib/activerecord-not_nil.rb
|
55
|
+
- lib/activerecord-not_nil/active_record/connection_adapters/quoting.rb
|
56
|
+
- lib/activerecord-not_nil/arel/visitors/to_sql.rb
|
55
57
|
homepage: https://github.com/payt/activerecord-not_nil
|
56
58
|
licenses:
|
57
59
|
- MIT
|
58
60
|
metadata: {}
|
59
|
-
post_install_message:
|
61
|
+
post_install_message:
|
60
62
|
rdoc_options: []
|
61
63
|
require_paths:
|
62
64
|
- lib
|
@@ -71,8 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
73
|
- !ruby/object:Gem::Version
|
72
74
|
version: '0'
|
73
75
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
75
|
-
signing_key:
|
76
|
+
rubygems_version: 3.5.9
|
77
|
+
signing_key:
|
76
78
|
specification_version: 4
|
77
79
|
summary: Add support for a not_nill type to active record.
|
78
80
|
test_files: []
|