るりまサーチ

最速Rubyリファレンスマニュアル検索!
451件ヒット [401-451件を表示] (0.061秒)

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. string gsub

モジュール

キーワード

検索結果

<< < ... 3 4 5 >>

WEBrick::HTTPResponse#to_s -> String (209.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...

Range#cover?(obj) -> bool (85.0)

obj が範囲内に含まれている時に true を返します。

...emlist[String の例][ruby]{
('b'..'d').include?('d') # => true
('b'..'d').include?('ba') # => false
('b'..'d').cover?('d') # => true
('b'..'d').cover?('ba') # => true
//}

//emlist[Date, DateTime の例][ruby]{
require 'date'
(Date.today - 365 .. Date.today + 365).include?(Date.today)...
...#=> true
(Date.today - 365 .. Date.today + 365).include?(DateTime.now) #=> false
(Date.today - 365 .. Date.today + 365).cover?(Date.today) #=> true
(Date.today - 365 .. Date.today + 365).cover?(DateTime.now) #=> true
//}


@see Range#include?, Range#===...
...#=> true
(Date.today - 365 .. Date.today + 365).include?(DateTime.now) #=> false
(Date.today - 365 .. Date.today + 365).cover?(Date.today) #=> true
(Date.today - 365 .. Date.today + 365).cover?(DateTime.now) #=> true
//}...

WEBrick::HTTPResponse#content_length -> Integer | nil (19.0)

Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実...
...'
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:
Content-Length: 2

ho...

WEBrick::HTTPResponse#content_length=(len) (19.0)

Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

...Content-Length ヘッダの値を整数で表すアクセサです。デフォルトは nil です。

: body が String オブジェクトである場合
content_length の値が nil のとき Content-Length ヘッダには
body のサイズが使われます。nil でないとき body の実...
...'
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:
Content-Length: 2

ho...

Range#cover?(range) -> bool (15.0)

2.6 以降の cover? は、Range#include? や Range#=== と異なり、 引数に Range オブジェクトを指定して比較できます。

2.6 以降の cover? は、Range#include? や Range#=== と異なり、
引数に Range オブジェクトを指定して比較できます。

引数が Range オブジェクトの場合、引数の範囲が self の範囲に含まれる時に true を返します。

@param range 比較対象の Range クラスのインスタンスを指定します。

//emlist[引数が Range の例][ruby]{
(1..5).cover?(2..3) #=> true
(1..5).cover?(0..6) #=> false
(1..5).cover?(1...6) ...

絞り込み条件を変える

<< < ... 3 4 5 >>