lib/eco/csv.rb in eco-helpers-2.0.25 vs lib/eco/csv.rb in eco-helpers-2.0.26
- old
+ new
@@ -3,18 +3,20 @@
module Eco
class CSV < ::CSV
class << self
+ # @return [Eco::CSV::Table]
def parse(data, **kargs, &block)
kargs = {headers: true, skip_blanks: true}.merge(kargs)
out = super(data, **kargs, &block).reject do |row|
values = row.to_hash.values
values.all?(&:nil?) || values.map(&:to_s).all?(&:empty?)
end
Eco::CSV::Table.new(out)
end
+ # @return [Eco::CSV::Table]
def read(file, **kargs)
kargs = {headers: true, skip_blanks: true}.merge(kargs)
args = [file].tap do |arg|
encoding = Eco::API::Common::Session::FileManager.encoding(file)