ruby-changes:8388
From: xibbar <ko1@a...>
Date: Fri, 24 Oct 2008 21:10:48 +0900 (JST)
Subject: [ruby-changes:8388] Ruby:r19919 (trunk): * lib/cgi/html.rb: allow symbolized key.
xibbar 2008-10-24 21:10:27 +0900 (Fri, 24 Oct 2008) New Revision: 19919 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19919 Log: * lib/cgi/html.rb: allow symbolized key. * test/cgi/test_cgi_tag_helper.rb: add a test. Modified files: trunk/ChangeLog trunk/lib/cgi/html.rb trunk/test/cgi/test_cgi_tag_helper.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19918) +++ ChangeLog (revision 19919) @@ -1,3 +1,9 @@ +Fri Oct 24 21:05:38 2008 Takeyuki FUJIOKA <xibbar@r...> + + * lib/cgi/html.rb: allow symbolized key. + + * test/cgi/test_cgi_tag_helper.rb: add a test. + Fri Oct 24 20:54:53 2008 Nobuyoshi Nakada <nobu@r...> * common.mk (exts): renamed to get rid of the existent directory. Index: lib/cgi/html.rb =================================================================== --- lib/cgi/html.rb (revision 19918) +++ lib/cgi/html.rb (revision 19919) @@ -27,11 +27,11 @@ attributes={attributes=>nil} if attributes.kind_of?(String) "<#{element.upcase}" + attributes.collect{|name, value| next unless value - " " + CGI::escapeHTML(name) + + " " + CGI::escapeHTML(name.to_s) + if true == value "" else - '="' + CGI::escapeHTML(value) + '"' + '="' + CGI::escapeHTML(value.to_s) + '"' end }.join + ">" END Index: test/cgi/test_cgi_tag_helper.rb =================================================================== --- test/cgi/test_cgi_tag_helper.rb (revision 19918) +++ test/cgi/test_cgi_tag_helper.rb (revision 19919) @@ -318,6 +318,7 @@ assert_match(/^<INPUT .*TYPE="checkbox".*>bb<INPUT .*TYPE="checkbox".*>dd$/,str) assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str) assert_match(/^<INPUT .*>bb<INPUT .*CHECKED.*>dd$/,str) + assert_match(/<INPUT .*TYPE="text".*>/,cgi.text_field(:name=>"name",:value=>"value")) if RUBY_VERSION>="1.9" str=cgi.radio_group("foo",["aa","bb"],["cc","dd",false]) assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/