種類
- インスタンスメソッド (55)
- 文書 (33)
- 特異メソッド (11)
ライブラリ
-
cgi
/ core (22) -
cgi
/ util (11) -
webrick
/ httpresponse (33)
クラス
- CGI (33)
-
WEBrick
:: HTTPResponse (33)
キーワード
-
content
_ length (11) -
content
_ length= (11) - header (11)
- pretty (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
to
_ s (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
CGI
# print(*strings) (18225.0) -
@todo
...@todo
引数の文字列を標準出力に出力します。
cgi.print は $DEFAULT_OUTPUT.print と等価です。
例:
cgi = CGI.new
cgi.print "This line is a part of content body.\r\n"... -
ruby 1
. 6 feature (324.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...りました。
p "#{ "" }"
=> ruby 1.6.7 (2002-03-01) [i586-linux]
""
=> -:1: warning: bad substitution in string
ruby 1.6.7 (2002-09-12) [i586-linux]
"#{ }"
=> ruby 1.6.7 (2002-09-25) [i586-linux]
""
これは1.7......:in `[]=': string not matched (IndexError)
from -:2
ruby 1.6.7 (2002-07-30) [i586-linux]
: 2002-06-03 sprintf()
"%d" で引数を整数にするときに、((<組み込み関数/Integer>)) と同じ規則を
使用するようになりました。
p sprintf("%d", ni......last_func may not be set.
差分は以下のようです。
@@ -227,10 +227,7 @@ rb_add_method(klass, mid, node, noex)
NODE *body;
if (NIL_P(klass)) klass = rb_cObject;
- if (klass == rb_cObject) {
- rb_secure(4);
- }
- if (rb_safe_leve... -
CGI
. pretty(string , shift = " ") -> String (268.0) -
HTML を人間に見やすく整形した文字列を返します。
...。
@param string HTML を指定します。
@param shift インデントに使用する文字列を指定します。デフォルトは半角空白二つです。
例:
require "cgi"
print CGI.pretty("<HTML><BODY></BODY></HTML>")
# <HTML>
# <BODY>......# </BODY>
# </HTML>
print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t")
# <HTML>
# <BODY>
# </BODY>
# </HTML>... -
CGI
# header(options = "text / html") -> String (137.0) -
HTTP ヘッダを options に従って生成します。 CGI#out と違い、標準出力には出力しません。 CGI#out を使わずに自力で HTML を出力したい場合などに使います。 このメソッドは文字列エンコーディングを変換しません。
...my_header1" => "my_value",
"my_header2" => "my_value"})
例:
cgi = CGI.new('html3')
print cgi.header({"charset" => "shift_jis", "status" => "OK"})
print "<html><head><title>TITLE</title></head>\r\n"
print "<body>BODY</body></html>\r\n"
@see 35911... -
WEBrick
:: HTTPResponse # to _ s -> String (113.0) -
実際にクライアントに送られるデータを文字列として返します。
...タを文字列として返します。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
res.body = 'hoge'
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 08:58:49 GMT
Server:
Content-Length: 4... -
ruby 1
. 8 . 3 feature (84.0) -
ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))
...。
$ ruby-1.8.2 -e 'p File.join(1, 2)'
"1/2"
$ ruby-1.8.3 -e 'p File.join(1, 2)'
-e:1:in `join': can't convert Fixnum into String (TypeError)
from -e:1
=== 2005-09-16
: File.extname [ruby] [compat]
与えられた pathname がピリオドで終る場合、ピ......lib] [new]
: Net::HTTPHeader#content_type= [lib] [new]
: Net::HTTPHeader#set_content_type [lib] [new]
: Net::HTTPRequest#body(=) [lib] [new]
: Net::HTTPRequest#body_stream(=) [lib] [new]
追加。
: Net::HTTPHeader#each_capitalized [lib] [compat]
: Net::HTTPHeader#each_capitali......として
ruby 1.8.3 に IO#((<IO/readpartial>)) が追加されました。
((<ruby-dev:25430>)) ((<ruby-dev:25443>))
$ ruby -e 'sleep 1; print "hoge"' | ruby-1.8.2 -rio/nonblock -we '
io = IO.open(0)
io.no... -
クラス/メソッドの定義 (60.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...ray を明示的に指定しても同じ)
class Foo
def bar
end
end
# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}
クラス定義式の中は self がそのクラスであることと、
limitのデ......['(' [arg0 ['=' default0]] ... [',' '*' rest_args [, post ...]] [',' key1: [val1]] ... [',' '**'kwrest] [',' '&' block_arg]`)']
式.. (body)
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]......][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}
メソッド定義において、仮引数はその種類毎に以下の順序でしか指定すること
は... -
WEBrick
:: HTTPResponse # content _ length -> Integer | nil (42.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...す。
: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実際のサイズとこの値が同じかどうかの検証は行われません。
: body が IO......。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 12:04:32 GMT
Server:
Cont... -
WEBrick
:: HTTPResponse # content _ length=(len) (42.0) -
Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。
...す。
: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実際のサイズとこの値が同じかどうかの検証は行われません。
: body が IO......。
require 'webrick'
include WEBrick
res = HTTPResponse.new( { :HTTPVersion => "1.1" } )
f = File.new('testfile')
res.body = f
res.content_length = 2
print res.to_s
#=> 出力結果
HTTP/1.1 200 OK
Connection: Keep-Alive
Date: Sat, 27 Oct 2007 12:04:32 GMT
Server:
Cont...