bin/wu-lign in wukong-3.0.0.pre vs bin/wu-lign in wukong-3.0.0.pre2
- old
+ new
@@ -159,11 +159,11 @@
format = maxw.zip(col_types, col_minmag, col_maxmag, ARGV).map do |width, type, minmag, maxmag, default|
next(lambda{|s| default % s rescue s }) if default.to_s != ''
case type
when :mixed, nil then lambda{|s| "%-#{width}s" % s }
when :str then lambda{|s| "%-#{width}s" % s }
- when :int then lambda{|s| "%#{width}d" % s.gsub(/\D+/, "").to_i }
- when :float then lambda{|s| "%#{maxmag+minmag+2}.#{minmag}f" % s.to_f }
+ when :int then lambda{|s| "%#{width}d" % s.gsub(/[^\d\-\+]+/, "").to_i }
+ when :float then lambda{|s| "%#{maxmag+minmag+2}.#{minmag}f" % s.gsub(/[^\d\.eE\-\+]+/, "").to_f }
else raise "oops type #{type}" end
end
def dump_row row, format
puts row.zip(format).map{|c,f| f.call(c) rescue c }.join("\t")