種類
- インスタンスメソッド (434)
- 文書 (105)
- ライブラリ (33)
- 特異メソッド (11)
ライブラリ
- ビルトイン (87)
-
cgi
/ core (22) - csv (22)
- digest (44)
- forwardable (22)
- json (33)
-
net
/ http (121) -
rexml
/ document (22) - tempfile (22)
- thread (6)
-
webrick
/ httpresponse (44)
クラス
- Array (16)
- CGI (22)
-
CSV
:: Table (22) -
Digest
:: Base (44) -
JSON
:: State (33) -
Net
:: HTTPGenericRequest (22) -
REXML
:: Attributes (22) - Struct (22)
- Tempfile (22)
- Thread (22)
-
Thread
:: Queue (33) -
WEBrick
:: HTTPResponse (44)
モジュール
- Forwardable (22)
-
Net
:: HTTPHeader (99)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - Ruby用語集 (11)
- [] (11)
-
backtrace
_ locations (22) -
block
_ length (11) - body= (11)
-
body
_ stream (11) -
body
_ stream= (11) - cgi (11)
- clear (11)
-
content
_ length (22) -
content
_ length= (22) -
content
_ range (11) - delegate (11)
- delete (11)
-
digest
_ length (11) - fetch (33)
- header (11)
-
instance
_ delegate (11) - out (11)
-
range
_ length (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - size (66)
- sum (16)
-
to
_ h (11) -
to
_ hash (11) -
to
_ s (11) - tsort (11)
-
webrick
/ cgi (11) - 制御構造 (11)
検索結果
先頭5件
-
JSON
:: State # to _ hash -> Hash (12.0) -
自身をハッシュに変換します。
...quire "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesting=>100,
# :depth=>0,
# :buffer_initial_length=>1024}
//}... -
Net
:: HTTPGenericRequest # body _ stream -> object (12.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do |f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
post.body_stream = f
post["Content-Length"] = f.size
end
post.body_stream # => #<File:/path/to/test... -
Net
:: HTTPGenericRequest # body _ stream=(f) (12.0) -
サーバに送るリクエストのエンティティボディを IO オブジェクトなどのストリームで設定します。 f は read(size) メソッドが定義されている必要があります。
...http://www.example.com/index.html')
post = Net::HTTP::Post.new(uri.request_uri)
File.open("/path/to/test", 'rb') do |f|
# 大きなファイルを扱う際にメモリ消費を少なくできる
post.body_stream = f
post["Content-Length"] = f.size
end
post.body_stream # => #<File:/path/to/test... -
Net
:: HTTPHeader # [](key) -> String|nil (12.0) -
key ヘッダフィールドを返します。
...とえばキー 'content-length' に対しては '2048'
のような文字列が得られます。キーが存在しなければ nil を返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req['user-... -
Ruby用語集 (12.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...である。
「[*0..9]」におけるいわゆる splat 展開の * や、
Proc オブジェクトをブロックとして渡す「strs.map(&:length)」に
おける & も演算子である。
defined? のように、見た目がメソッドのような演算子もある。
参照:spec......文字としては特別扱いされない。
ただしパス名には使えず、ヌル文字を含んだ文字列を File.open や
Pathname.new に与えると ArgumentError が発生する。
他の言語では文字列の終端を意味することがあるので、文字列データ... -
WEBrick
:: HTTPResponse # body=(val) (12.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
hoge... -
WEBrick
:: HTTPResponse # to _ s -> String (12.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
hoge... -
制御構造 (12.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...nil を返します。
=== 繰り返し
====[a:while] while
//emlist[例][ruby]{
ary = [0,2,4,8,16,32,64,128,256,512,1024]
i = 0
while i < ary.length
print ary[i]
i += 1
end
//}
文法:
while 式 [do]
...
end
式を評価した値が真の間、本体を......# 例外 RuntimeError を発生させる
# 以下の二つは SyntaxError を発生させる
raise SyntaxError, "invalid syntax"
raise SyntaxError.new("invalid syntax")
raise # 最後の例外の再発生
//}
文法:
raise
raise messageまたはexception...