Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
annotato (0.2.2)
annotato (0.2.3)
rails (>= 6.0)

GEM
Expand Down
12 changes: 6 additions & 6 deletions lib/annotato/column_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ def self.format(model, connection)
type = col.sql_type

# Build the left-hand side and calculate indent.
left = "# %-#{name_width}s :%-#{type_width}s" % [name, type]
# " default(" is 9 chars; +2 gives the extra gap.
# Strip trailing padding spaces immediately — output must never have trailing whitespace.
left = ("# %-#{name_width}s :%-#{type_width}s" % [name, type]).rstrip
# indent_size aligns multiline default content under the opening "default(" token.
indent_size = left.length + 1
indent_str = " " * indent_size
closing_indent_str = " " * (indent_size - 2)
closing_indent_str = " " * (indent_size - 2)

# Gather all options, pulling out default_lines if multiline.
opts = []
Expand Down Expand Up @@ -64,10 +65,9 @@ def self.format(model, connection)
opts_str = opts.join(", ")
line = opts_str.empty? ? left : "#{left} #{opts_str}"
if line.length > WrapHelper::MAX_LINE && !opts_str.empty?
cont_indent = " " * (left.length + 1)
[left, "# #{cont_indent}#{opts_str}"]
[left, "# #{opts_str}"]
else
[line.rstrip]
[line]
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/annotato/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Annotato
VERSION = "0.2.2"
VERSION = "0.2.3"
end
Loading