種類
- インスタンスメソッド (121)
- ライブラリ (22)
- 文書 (22)
クラス
- Array (33)
- MatchData (22)
-
Net
:: HTTPResponse (11) - StringScanner (22)
モジュール
-
Net
:: HTTPHeader (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - end (11)
- fetch (66)
- pointer= (11)
- pos= (11)
- rdoc (11)
- rss (11)
-
ruby 1
. 6 feature (11) - value (11)
検索結果
先頭5件
-
MatchData
# begin(n) -> Integer | nil (18143.0) -
n 番目の部分文字列先頭のオフセットを返します。
...。
@raise IndexError 範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil
p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}... -
rss (114.0)
-
RSS を扱うためのライブラリです。
...はない RSS だった
場合はバリデーション無しでパースするには以下のように書きます。
require 'rss'
rss = nil
begin
rss = RSS::Parser.parse(rss_source)
rescue RSS::InvalidRSSError
rss = RSS::Parser.parse(rss_source, false)
end
これは rss_source......xampleというサイトを
* http://example.com/index.rdfという名前のRSS 1.0
を生成するには以下のようにします.
require "rss"
rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = "http://example.com/index.rdf"
maker.channel.title = "Example"
make......ければ以下のようにします.
require "rss"
rss = RSS::Maker.make("1.0") do |maker|
maker.channel.about = "http://example.com/index.rdf"
maker.channel.title = "Example"
maker.channel.description = "Example Site"
maker.channel.link = "http://example.com/"
item = m... -
rdoc (48.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...ます。'#' で始まるコメントも使え
ますし、=begin/=end でのコメントも使えます。=begin/=end を使う場合は、
以下のように =begin の行に 'rdoc' タグを付ける必要があります。
=begin rdoc
Documentation to
be processed by RDoc.
=end
パラ......the name of one or more output files. If multiple
files are present, the first is used as the index.
<tt>--quiet:</tt>:: do not output the names, sizes, byte counts,
index areas, or bit ratios of units as
they are processed.
====[a:headline] 見......トを書くと、この出力を上書
きできます。
def fred # :yields: index, position
...
yield line, address
上のようにすると、以下の出力になります。
fred() { |index, position| ... }
====[a:escape] エスケープ
マークアップは <tt> タグ... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (30.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...776>))
: ((<"rescue/ensure on begin .. end while"|制御構造/while 修飾子>)) [compat]
rescue/ensure を持つ begin 式も while/until 修飾できるようになりまし
た。
以前は、rescue/ensure を持つ while/until 修飾式は、通常の begin 式に
while/until 修飾......[new]
: ((<aStruct#values_at|Struct/values_at>)) [new]
ruby 1.6 の ((<indexes|Array/indexes>)) は、values_at というメソッド
名になりました(ruby 1.7 では block なし ((<select|Array/select>)) が
indexes の代わりでしたが、こちらも使用すると警告が出ま......映された上で obsolete)
# str =~ arg だけは、arg が文字列のとき、
# Regexp.compile(Regexp.quote(arg)) =~ str と等価な str.index(arg) が
# 実行されます(したがって、$~ は設定されません)。
$; の指定に正規表現が許されるようになりま... -
Net
:: HTTPHeader # fetch(key) -> String (24.0) -
key ヘッダフィールドを返します。
...指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist[例 key のみ指定。key が存在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::G......在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.r......q.fetch("content-length", "default") # => "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
Net
:: HTTPHeader # fetch(key) {|hash| . . . . } -> String (24.0) -
key ヘッダフィールドを返します。
...指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist[例 key のみ指定。key が存在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::G......在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.r......q.fetch("content-length", "default") # => "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
Net
:: HTTPHeader # fetch(key , default) -> String (24.0) -
key ヘッダフィールドを返します。
...指定します。
@raise IndexError 引数defaultもブロックも与えられてない時、キーの探索に 失敗すると発生します。
//emlist[例 key のみ指定。key が存在する][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::G......在しない][ruby]{
require 'net/http'
begin
req.fetch("content-length")
rescue => e
e # => #<KeyError: key not found: "content-length">
end
//}
//emlist[例 key , default を指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.r......q.fetch("content-length", "default") # => "default"
//}
//emlist[例 key とブロックを指定][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.fetch("content-length") { |e| 99 } # => 99
//}
@see Net::HTTPHeader#[]... -
ruby 1
. 6 feature (24.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...返していた
p "foo".slice!(5,10)
=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil
-:2:in `slice!': index 5 out of string (IndexError)
from -:2
=> ruby 1.6.7 (2002-08-01) [i586-linux]
nil
nil
: 2002-07-05 String#spli......p foo["bar"] = "baz"
p foo
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"baz"
"foo"
=> -:2:in `[]=': string not matched (IndexError)
from -:2
ruby 1.6.7 (2002-07-30) [i586-linux]
: 2002-06-03 sprintf()
"%d" で引数を整数にするときに、((<......問題に対処しました。((<ruby-dev:13194>))
: Ctrl-C (Interrupt)が効かなくなる
((<ruby-dev:13195>))
th1 = Thread.start {
begin
Thread.stop
ensure
Thread.pass
Thread.stop
end
}
sleep 1
(確認できる限りでは ruby-1.7.0... -
Array
# fetch(nth) -> object (12.0) -
nth 番目の要素を返します。
...返します。
Array#[] (nth) とは nth 番目の要素が存在しない場合の振舞いが異
なります。最初の形式では、例外 IndexError が発生します。
二番目の形式では、引数 ifnone を返します。
三番目の形式では、ブロックを評価した結果......す。
@raise IndexError 引数 ifnone もブロックも指定しておらず、 nth 番目の要
素も存在しなかった場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
e... -
Array
# fetch(nth) {|nth| . . . } -> object (12.0) -
nth 番目の要素を返します。
...返します。
Array#[] (nth) とは nth 番目の要素が存在しない場合の振舞いが異
なります。最初の形式では、例外 IndexError が発生します。
二番目の形式では、引数 ifnone を返します。
三番目の形式では、ブロックを評価した結果......す。
@raise IndexError 引数 ifnone もブロックも指定しておらず、 nth 番目の要
素も存在しなかった場合に発生します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5]
begin
p a.fetch(10)
rescue IndexError => err
puts err #=> index 10 out of array
e...