lib/eco/csv.rb in eco-helpers-2.0.66 vs lib/eco/csv.rb in eco-helpers-2.0.67
- old
+ new
@@ -6,37 +6,22 @@
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)
+ Eco::CSV::Table.new(super(data, **kargs, &block))
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)
- #encoding = (encoding != "utf-8")? "#{encoding}|utf-8": encoding
- #arg.push(encoding)
arg.push("rb:bom|utf-8") if encoding == "bom"
end
-
- out = super(*args, **kargs).reject do |row|
- values = row.to_hash.values
- values.all?(&:nil?) || values.map(&:to_s).all?(&:empty?)
- end
- Eco::CSV::Table.new(out)
+ Eco::CSV::Table.new(super(*args, **kargs))
end
-
end
-
-
end
end
require_relative 'csv/table'