Skip to content

Commit bfc2027

Browse files
committed
Uses .tap to get rid of cognitive complexity
1 parent e67e7c3 commit bfc2027

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

app/controllers/stories_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def export
103103

104104
def generate_csv(stories, with_comments: false, export_all: false)
105105
CSV.generate(headers: true) do |csv|
106-
headers = CSV_HEADERS.dup
107-
headers << "comment" if with_comments
108-
csv << headers
106+
csv << CSV_HEADERS.dup.tap { |headers| headers << "comment" if with_comments }
109107

110108
stories.by_position.each do |story|
111109
if with_comments

0 commit comments

Comments
 (0)