Skip to content

Commit

Permalink
update writer to skip null rows
Browse files Browse the repository at this point in the history
  • Loading branch information
deepaklakhera authored and deepaklakhera committed Jan 8, 2025
1 parent a76301a commit c522d25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rhykane/writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def initialize(*, **)
@io = ::CSV.new(io, **opts)
end

def puts(*rows) = io.puts(*rows.map(&method(:row_to_csv).to_proc).compact)
def puts(*rows) = io.puts(*rows.compact.map(&method(:row_to_csv).to_proc))

private

def row_to_csv(row)
case row
in **row
::CSV::Row.new(row.keys, row.values)
else
in *row
row
end
end
Expand Down

0 comments on commit c522d25

Please sign in to comment.