Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

1# frozen_string_literal: true
2
3class MigrateTimelinePreviewSetting < ActiveRecord::Migration[8.0]
4 class Setting < ApplicationRecord; end
5
6 def up
7 setting = Setting.find_by(var: 'timeline_preview')
8 return unless setting.present? && setting.attributes['value'].present?
9
10 value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
11
12 Setting.upsert_all(
13 %w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).map do |var|
14 { var: var, value: value ? "--- public\n" : "--- authenticated\n" }
15 end
16 )
17 end
18
19 def down; end
20end
21

After

1# frozen_string_literal: true
2
3class MigrateTimelinePreviewSetting < ActiveRecord::Migration[8.0]
4 class Setting < ApplicationRecord; end
5
6 def up
7 Setting.reset_column_information
8
9 setting = Setting.find_by(var: 'timeline_preview')
10 return unless setting.present? && setting.attributes['value'].present?
11
12 value = YAML.safe_load(setting.attributes['value'], permitted_classes: [ActiveSupport::HashWithIndifferentAccess, Symbol])
13
14 Setting.upsert_all(
15 %w(local_live_feed_access remote_live_feed_access local_topic_feed_access remote_topic_feed_access).map do |var|
16 { var: var, value: value ? "--- public\n" : "--- authenticated\n" }
17 end,
18 unique_by: index_exists?(:settings, [:thing_type, :thing_id, :var]) ? [:thing_type, :thing_id, :var] : :var
19 )
20 end
21
22 def down; end
23end
24

Before

program
comment "# frozen_string_literal: true"
class
class "class"
constant "MigrateTimelinePreviewSetting"
superclass
< "<"
element_reference
scope_resolution
constant "ActiveRecord"
:: "::"
constant "Migration"
[ "["
float "8.0"
] "]"
body_statement
class
class "class"
constant "Setting"
superclass
< "<"
constant "ApplicationRecord"
; ";"
end "end"
method
def "def"
identifier "up"
body_statement
assignment
identifier "setting"
= "="
call
constant "Setting"
. "."
identifier "find_by"
argument_list
( "("
pair
hash_key_symbol "var"
: ":"
string
" "'"
string_content "timeline_preview"
" "'"
) ")"
unless_modifier (+24 nodes collapsed)
assignment (+34 nodes collapsed)
call
constant "Setting"
. "."
identifier "upsert_all"
argument_list
( "("
call (+47 nodes collapsed)
) ")"
end "end"
method
def "def"
identifier "down"
; ";"
end "end"
end "end"

After

program
comment "# frozen_string_literal: true"
class
class "class"
constant "MigrateTimelinePreviewSetting"
superclass
< "<"
element_reference
scope_resolution
constant "ActiveRecord"
:: "::"
constant "Migration"
[ "["
float "8.0"
] "]"
body_statement
class
class "class"
constant "Setting"
superclass
< "<"
constant "ApplicationRecord"
; ";"
end "end"
method
def "def"
identifier "up"
body_statement
call
constant "Setting"
. "."
identifier "reset_column_information"
assignment
identifier "setting"
= "="
call
constant "Setting"
. "."
identifier "find_by"
argument_list
( "("
pair
hash_key_symbol "var"
: ":"
string
" "'"
string_content "timeline_preview"
" "'"
) ")"
unless_modifier (+24 nodes collapsed)
assignment (+34 nodes collapsed)
call
constant "Setting"
. "."
identifier "upsert_all"
argument_list
( "("
call (+47 nodes collapsed)
, ","
pair
hash_key_symbol "unique_by"
: ":"
conditional
call
identifier "index_exists?"
argument_list
( "("
simple_symbol ":settings"
, ","
array
[ "["
simple_symbol ":thing_type"
, ","
simple_symbol ":thing_id"
, ","
simple_symbol ":var"
] "]"
) ")"
? "?"
array
[ "["
simple_symbol ":thing_type"
, ","
simple_symbol ":thing_id"
, ","
simple_symbol ":var"
] "]"
: ":"
simple_symbol ":var"
) ")"
end "end"
method
def "def"
identifier "down"
; ";"
end "end"
end "end"