quote-sql 0.0.8 → 0.0.9

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: b1ae8afe082e0867130f3933c76e867ac3f16f53b816db61cd9a9cabdfeb3298
4
- data.tar.gz: d5c1638521b04e8e62ff2dab8a27a27165f27f972ea4bc6e5f6e55e4680a8cb6
3
+ metadata.gz: 37390ee5356d22cf9fe8b2ba9d737e35c5ac6d39a69e8db62bb4b554c15328dc
4
+ data.tar.gz: cefa08d46fe1b51de03327f0840daa0059fc9da503225b4379c2cd8213fe455e
5
5
  SHA512:
6
- metadata.gz: 886abf29ad27600528bd42dd88e4c13da41a1c7076b7bc9a69592d07f8d1653962eb9daaab68eb897238f5b4069658496919a254d01a53b5656cbff9c02bc958
7
- data.tar.gz: '085c3fd76781bf95c658151398970fdc6de805767d495d4c23cc9e8cbd444cd61335b73162b99cc16d71eb1f8d268d8c7824244c5e2d6eafe47fe1bd20aaed0e'
6
+ metadata.gz: 51fb6f48e65548dd29402fac1b4d4de5d0ebdf3dcec0e591ea10d4144be82e10e24100f535ae62627b88863ab5517b770f53fe13a24febdb2676669dbc37f674
7
+ data.tar.gz: cd07e668bcbe753cfd180560191d66eedfe1de87f37f33f461f4f05f981c2818e0bae83892182b17b012290fbffe13ca55fb2bac9544387d314b639d91b65a89
@@ -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 /(?:^|(.*)_)table$/i
86
+ when /(?:^|(.+)_)table_name$/i
87
87
  ident_table
88
- when /(?:^|(.*)_)columns$/i
88
+ when /(?:^|(.+)_)table$/i
89
+ ident_table
90
+ when /(?:^|(.+)_)columns$/i
89
91
  ident_columns
90
- when /(?:^|(.*)_)(ident)$/i
92
+ when /(?:^|(.+)_)(ident|column)$/i
91
93
  _ident
92
- when /(?:^|(.*)_)constraints?$/i
94
+ when /(?:^|(.+)_)constraints?$/i
93
95
  quotable.to_s
94
- when /(?:^|(.*)_)(raw|sql)$/i
96
+ when /(?:^|(.+)_)(raw|sql)$/i
95
97
  quotable.to_s
96
- when /(?:^|(.*)_)json$/i
98
+ when /(?:^|(.+)_)json$/i
97
99
  json_recordset
98
100
  when /^(.+)_values$/i
99
101
  values
@@ -1,3 +1,3 @@
1
1
  class QuoteSql
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.transform_keys(&:to_sym)
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.8
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-04 00:00:00.000000000 Z
11
+ date: 2024-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: niceql