Skip to content

Commit b2c2f04

Browse files
fix format strings
1 parent e173e6b commit b2c2f04

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/code/format.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def extract_string_concatenation_parts(statement)
444444
return nil unless statement.is_a?(Hash)
445445

446446
if statement.key?(:string)
447-
return Array(statement[:string])
447+
return Array(statement[:string]).deep_dup
448448
end
449449

450450
return nil unless statement.key?(:left_operation)

spec/code/format_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
"event[:uid].present? and event[:summary].present? and event[:starts_at].present? and event[:ends_at].present?",
3232
"event[:uid].present?\n and event[:summary].present?\n and event[:starts_at].present?\n and event[:ends_at].present?"
3333
],
34+
[
35+
"Html.p { \"x{Time.new(event.starts_at).format}y\" + \"{Time.new(event.ends_at).format}\" }",
36+
"Html.p {\n \"x{Time.new(event.starts_at).format}y\"\n + \"{Time.new(event.ends_at).format}\"\n}"
37+
],
3438
[
3539
"sum = (a, b: 2) => { a + b } sum(1)",
3640
"sum = (a, b: 2) => {\n a + b\n}\n\nsum(1)"

0 commit comments

Comments
 (0)