るりまサーチ

最速Rubyリファレンスマニュアル検索!
583件ヒット [501-583件を表示] (0.034秒)
トップページ > クエリ:new[x] > クエリ:length[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

検索結果

<< < ... 4 5 6 >>

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...
<< < ... 4 5 6 >>