lib/args_parser/parser.rb in args_parser-0.0.2 vs lib/args_parser/parser.rb in args_parser-0.0.3

- old
+ new

@@ -60,10 +60,12 @@ if arg =~ /^-+[^-\s]+$/ params[k][:value] = true k = arg.scan(/^-+([^-\s]+)$/)[0][0].strip.to_sym k = aliases[k] if aliases[k] else + arg = arg.to_i if arg =~ /^\d+$/ + arg = arg.to_f if arg =~ /^\d+\.\d+$/ params[k][:value] = arg k = nil end end end @@ -87,10 +89,10 @@ end def has_param?(*param_) !(param_.flatten.map{|i| v = self[i] - (v and v.kind_of? String) ? true : false + (v and [String, Fixnum, Float].include? v.class) ? true : false }.include? false) end def inspect h = Hash.new