class Object def blank? respond_to?(:empty?) ? empty? : !self end end class Hash def to_query_string self.map { |k, v| "#{k}=#{v}" }.join("&") end end class String def blank? self !~ /\S/ end def invalid? self !~ /^\d{5}-\d{3}$/ end def clean self.gsub "-", "" end end