lib/vowpalwabbit/model.rb in vowpalwabbit-0.1.2 vs lib/vowpalwabbit/model.rb in vowpalwabbit-0.1.3

- old
+ new

@@ -62,24 +62,24 @@ @handle ||= FFI.VW_InitializeA(param_str(@params)) end def param_str(params) args = - params.map do |k, v| + params.flat_map do |k, v| check_param(k.to_s) check_param(v.to_s) if v == true - "--#{k}" + ["--#{k}"] elsif !v - nil + [] elsif k.size == 1 - "-#{k} #{v}" + ["-#{k}", v] else - "--#{k} #{v}" + ["--#{k}", v] end end - args.compact.join(" ") + args.join(" ") end def check_param(v) raise ArgumentError, "Invalid parameter" if /[[:space:]]/.match(v) end