Skip to content

Commit

Permalink
Update quotes for heredocs with embedded Ruby with \n
Browse files Browse the repository at this point in the history
The default behaviour for heredocs is the double quote style of quotes, which
means the generated code looks like:

    ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized
    " })

It works, but it's ugly.
  • Loading branch information
herwinw authored and andrykonchin committed Jan 8, 2025
1 parent e43dcce commit b9c5d34
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/binding/shared/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
end

it "copies the finalizer" do
code = <<-RUBY
code = <<-'RUBY'
obj = binding
ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized\n" })
Expand Down
2 changes: 1 addition & 1 deletion core/method/shared/dup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

it "copies the finalizer" do
code = <<-RUBY
code = <<-'RUBY'
obj = Object.new.method(:method)
ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized\n" })
Expand Down
2 changes: 1 addition & 1 deletion core/objectspace/define_finalizer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def finalizer(zelf)
end

it "allows multiple finalizers with different 'callables' to be defined" do
code = <<-RUBY
code = <<-'RUBY'
obj = Object.new
ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized1\n" })
Expand Down
2 changes: 1 addition & 1 deletion core/proc/shared/dup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
end

it "copies the finalizer" do
code = <<-RUBY
code = <<-'RUBY'
obj = Proc.new { }
ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized\n" })
Expand Down
2 changes: 1 addition & 1 deletion core/unboundmethod/shared/dup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

it "copies the finalizer" do
code = <<-RUBY
code = <<-'RUBY'
obj = Class.instance_method(:instance_method)
ObjectSpace.define_finalizer(obj, Proc.new { STDOUT.write "finalized\n" })
Expand Down

0 comments on commit b9c5d34

Please sign in to comment.