Sha256: f07ce131418e0bf8f096203c7fb76911876dda4877189fb1d6e71af1b564a9c8
Contents?: true
Size: 553 Bytes
Versions: 1
Compression:
Stored size: 553 Bytes
Contents
module HoneyFormat # Default row builder class RowBuilder < Struct # Create a row # @return [Struct] returns an instantiated Struct representing a row def self.call(row) new(*row) end # Represent row as CSV # @return [String] CSV-string representation. def to_csv row = members.map do |column_name| column = public_send(column_name) next column.to_csv if column.respond_to?(:to_csv) next if column.nil? column.to_s end ::CSV.generate_line(row) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
honey_format-0.8.2 | lib/honey_format/row_builder.rb |