sql_beautifier 0.10.4 → 0.10.5

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: 7c92d6b96851b3e1d24b983a6cf8d3d01ee643f4418d7c66cdc92bdc32baa132
4
- data.tar.gz: 8cf024876d629ff3a2beaae6604c4cc860a6652582b90bf1f3c6c4001acc3517
3
+ metadata.gz: cb887e1c6ce5f0084f039ec0fd92717e861dc425bd40ce447c113726a7e16a30
4
+ data.tar.gz: e13a2ea6cb4986e819d5653fa4dc714592c56faadd71b2826e457b7208dc8464
5
5
  SHA512:
6
- metadata.gz: 0252dddc816463054f4bcd225485cadb58eac11d964f6fd1f18e1d5fa3b23c2619caa0dc38d8f3395f7616fcf5e0e7d5d52e60bfca4f7d96b83fbfec7d345f19
7
- data.tar.gz: 6dfa3284884d2c4df58d93dab99b31dcebce6e07f00a71d499a71bd37f0030a680f905ca15565b23e97f860b53a108feb23d5a3d004e2967c328eace9ff51bfe
6
+ metadata.gz: e9964b5ed83c63bc41b79be3356ca96b448b460c380caf7e73431fc4a2009d7473483546bb3a1e90cfd106f878fe0b01a808eda60e38ffdcb1abba4e2a5ad61f
7
+ data.tar.gz: 6e7c5ac77fc86253a8e83f1ce2e8acbc578a3799f3d768d8f5fae26181724b104635f35c5fb5ea2ada9fb044c1f0daabdddc5af3c7eb78661caa63e1e6b57022
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [X.X.X] - YYYY-MM-DD
4
4
 
5
+ ## [0.10.5] - 2026-04-08
6
+
7
+ - Change CTE formatting to use compact `with` prefix — `with` is no longer padded to the keyword column width; CTE body lines are indented by `indent_spaces` from column zero instead of from the keyword column, and the closing `)` sits at column zero; subsequent CTE definitions in multi-CTE queries also start at column zero
8
+ - Apply table name formatting to CTE definition names — CTE names in the `with ... as (` header now follow the `table_name_format` setting (PascalCase by default), matching how CTE references are formatted in `FROM` clauses
9
+
5
10
  ## [0.10.4] - 2026-03-30
6
11
 
7
12
  - Add `IN` list multiline formatting — `WHERE x IN (1, 2, 3)` value lists with 2+ items are now expanded to one item per line with proper indentation; single-item lists and `IN (SELECT ...)` subqueries are left unchanged
@@ -8,7 +8,8 @@ module SqlBeautifier
8
8
  option :materialization, default: -> {}
9
9
 
10
10
  def render_header
11
- header = +@name.to_s
11
+ formatted_name = @name.start_with?(Constants::DOUBLE_QUOTE) ? @name : Util.format_table_name(@name)
12
+ header = +formatted_name
12
13
  header << " (#{@column_list})" if @column_list
13
14
  header << " #{Util.format_keyword('as')}"
14
15
  header << " #{format_materialization}" if @materialization
@@ -102,21 +102,16 @@ module SqlBeautifier
102
102
  end
103
103
 
104
104
  def render
105
- keyword_width = SqlBeautifier.config_for(:keyword_column_width)
106
- continuation_indent = Util.continuation_padding
107
-
108
105
  output = +""
109
106
 
110
107
  @definitions.each_with_index do |definition, index|
111
108
  if index.zero?
112
- output << Util.keyword_padding("with")
109
+ output << "#{Util.format_keyword('with')} "
113
110
  output << "#{Util.format_keyword('recursive')} " if @recursive
114
- else
115
- output << continuation_indent
116
111
  end
117
112
 
118
113
  output << definition.render_header
119
- output << definition.render_body(keyword_width)
114
+ output << definition.render_body(0)
120
115
  output << (index < @definitions.length - 1 ? ",\n" : "\n\n")
121
116
  end
122
117
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SqlBeautifier
4
- VERSION = "0.10.4"
4
+ VERSION = "0.10.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql_beautifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.4
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kinnell Shah