quote-sql 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quote_sql/quoter.rb +8 -6
- data/lib/quote_sql/version.rb +1 -1
- data/lib/quote_sql.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37390ee5356d22cf9fe8b2ba9d737e35c5ac6d39a69e8db62bb4b554c15328dc
|
4
|
+
data.tar.gz: cefa08d46fe1b51de03327f0840daa0059fc9da503225b4379c2cd8213fe455e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51fb6f48e65548dd29402fac1b4d4de5d0ebdf3dcec0e591ea10d4144be82e10e24100f535ae62627b88863ab5517b770f53fe13a24febdb2676669dbc37f674
|
7
|
+
data.tar.gz: cd07e668bcbe753cfd180560191d66eedfe1de87f37f33f461f4f05f981c2818e0bae83892182b17b012290fbffe13ca55fb2bac9544387d314b639d91b65a89
|
data/lib/quote_sql/quoter.rb
CHANGED
@@ -83,17 +83,19 @@ class QuoteSql
|
|
83
83
|
def to_sql
|
84
84
|
return @quotable.call(self) if @quotable.is_a? Proc
|
85
85
|
case key.to_s
|
86
|
-
when /(?:^|(
|
86
|
+
when /(?:^|(.+)_)table_name$/i
|
87
87
|
ident_table
|
88
|
-
when /(?:^|(
|
88
|
+
when /(?:^|(.+)_)table$/i
|
89
|
+
ident_table
|
90
|
+
when /(?:^|(.+)_)columns$/i
|
89
91
|
ident_columns
|
90
|
-
when /(?:^|(
|
92
|
+
when /(?:^|(.+)_)(ident|column)$/i
|
91
93
|
_ident
|
92
|
-
when /(?:^|(
|
94
|
+
when /(?:^|(.+)_)constraints?$/i
|
93
95
|
quotable.to_s
|
94
|
-
when /(?:^|(
|
96
|
+
when /(?:^|(.+)_)(raw|sql)$/i
|
95
97
|
quotable.to_s
|
96
|
-
when /(?:^|(
|
98
|
+
when /(?:^|(.+)_)json$/i
|
97
99
|
json_recordset
|
98
100
|
when /^(.+)_values$/i
|
99
101
|
values
|
data/lib/quote_sql/version.rb
CHANGED
data/lib/quote_sql.rb
CHANGED
@@ -97,7 +97,9 @@ uuid xml hstore
|
|
97
97
|
|
98
98
|
# Add quotes keys are symbolized
|
99
99
|
def quote(quotes = {})
|
100
|
+
quotes = quotes.transform_keys(&:to_sym)
|
100
101
|
re = /(?:^|(.*)_)(table|columns|casts)$/i
|
102
|
+
(table_name = quotes[:table_name].presence) and (@tables[:table] ||= table_name)
|
101
103
|
quotes.keys.grep(re).each do |quote|
|
102
104
|
_, name, type = quote.to_s.match(re)&.to_a
|
103
105
|
value = quotes.delete quote
|
@@ -105,7 +107,7 @@ uuid xml hstore
|
|
105
107
|
send(:"#{type}=", [name, value])
|
106
108
|
# instance_variable_get(:"@#{type.sub(/s*$/,'s')}")[name&.to_sym] = value
|
107
109
|
end
|
108
|
-
@quotes.update quotes
|
110
|
+
@quotes.update quotes
|
109
111
|
self
|
110
112
|
end
|
111
113
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quote-sql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kufner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: niceql
|