Skip to content

Commit

Permalink
Uses .tap to get rid of cognitive complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
torresga committed Nov 7, 2024
1 parent e67e7c3 commit bfc2027
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/controllers/stories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ def export

def generate_csv(stories, with_comments: false, export_all: false)
CSV.generate(headers: true) do |csv|
headers = CSV_HEADERS.dup
headers << "comment" if with_comments
csv << headers
csv << CSV_HEADERS.dup.tap { |headers| headers << "comment" if with_comments }

stories.by_position.each do |story|
if with_comments
Expand Down

0 comments on commit bfc2027

Please sign in to comment.