ライブラリ
- ビルトイン (258)
- csv (24)
- matrix (72)
-
net
/ http (24) - psych (12)
-
rexml
/ document (60) -
rubygems
/ source _ index (36) - socket (24)
クラス
- Array (128)
-
CSV
:: FieldInfo (12) -
CSV
:: Row (12) -
Gem
:: SourceIndex (36) - MatchData (28)
- Matrix (72)
-
Psych
:: Parser :: Mark (12) -
REXML
:: Elements (12) -
REXML
:: Parent (48) - Regexp (12)
-
Socket
:: AncillaryData (12) -
Socket
:: Ifaddr (12) - String (54)
モジュール
- Enumerable (36)
-
Net
:: HTTPHeader (24)
キーワード
- []= (36)
- begin (12)
-
bsearch
_ index (20) - bytebegin (2)
- byteend (2)
- byteindex (3)
- byterindex (3)
-
content
_ length (12) - end (12)
-
find
_ index (108) - getbyte (12)
- ifindex (12)
-
ipv6
_ pktinfo _ ifindex (12) - length (12)
-
named
_ captures (12) -
range
_ length (12) - rindex (48)
- setbyte (12)
- size (24)
検索結果
先頭5件
-
Array
# find _ index(val) -> Integer | nil (6235.0) -
条件に一致する最初の要素の位置を返します。
...しい要素がひとつもなかった場合は nil を返します。
//emlist[例][ruby]{
p [1, 0, 0, 1, 0].index(1) #=> 0
p [1, 0, 0, 0, 0].index(1) #=> 0
p [0, 0, 0, 0, 0].index(1) #=> nil
//}
ブロックが与えられた場合には、各要素を引数として順にブロックを......返します。
一つも真にならなかった場合は nil を返します。
//emlist[例][ruby]{
p [0, 1, 0, 1, 0].index {|v| v > 0} #=> 1
//}
引数、ブロックのどちらも与えられなかった場合は、
Enumerator のインスタンスを返します。
@see Array#rindex... -
Enumerable
# find _ index {|obj| . . . } -> Integer | nil (6230.0) -
条件に一致する最初の要素の位置を返します。
...置を返します。
等しい要素がひとつもなかった場合は nil を返します。
//emlist[例][ruby]{
(1..10).find_index(11) #=> nil
(1..10).find_index(2) #=> 1
//}
ブロックが与えられた場合には、各要素を引数として先頭から順にブロックを実行し......します。
一つも真にならなかった場合は nil を返します。
//emlist[例][ruby]{
(1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
(1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
//}
引数、ブロックのどちらも与えられなかった場合は... -
Enumerable
# find _ index(val) -> Integer | nil (6230.0) -
条件に一致する最初の要素の位置を返します。
...置を返します。
等しい要素がひとつもなかった場合は nil を返します。
//emlist[例][ruby]{
(1..10).find_index(11) #=> nil
(1..10).find_index(2) #=> 1
//}
ブロックが与えられた場合には、各要素を引数として先頭から順にブロックを実行し......します。
一つも真にならなかった場合は nil を返します。
//emlist[例][ruby]{
(1..10).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
(1..100).find_index {|i| i % 5 == 0 and i % 7 == 0 } #=> 34
//}
引数、ブロックのどちらも与えられなかった場合は... -
String
# rindex(pattern , pos = self . size) -> Integer | nil (6226.0) -
文字列のインデックス pos から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。
...列または正規表現で指定します。
pos が負の場合は、文字列の末尾から数えた位置から探索します。
rindex と String#index とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......//emlist[String#index の場合][ruby]{
p "stringstring".index("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#rindex の場合][ruby]{
p "stringstring".rindex("ing", -1) # =......ンデックス
//emlist[例][ruby]{
p "astrochemistry".rindex("str") # => 10
p "character".rindex(?c) # => 5
p "regexprindex".rindex(/e.*x/, 2) # => 1
p "foobarfoobar".rindex("bar", 6) # => 3
p "foobarfoobar".rindex("bar", -6) # => 3
//}
@see String#index... -
Array
# rindex {|item| . . . } -> Integer | nil (6209.0) -
指定された val と == で等しい最後の要素の位置を返します。 等しい要素がひとつもなかった時には nil を返します。
...身と rindex から生成した
Enumerator オブジェクトを返します。
@param val オブジェクトを指定します。
//emlist[例][ruby]{
p [1, 0, 0, 1, 0].rindex(1) #=> 3
p [1, 0, 0, 0, 0].rindex(1) #=> 0
p [0, 0, 0, 0, 0].rindex(1) #=> nil
p [0, 1, 0, 1, 0].rindex {|v| v > 0......} #=> 3
//}
@see Array#index... -
Array
# rindex(val) -> Integer | nil (6209.0) -
指定された val と == で等しい最後の要素の位置を返します。 等しい要素がひとつもなかった時には nil を返します。
...身と rindex から生成した
Enumerator オブジェクトを返します。
@param val オブジェクトを指定します。
//emlist[例][ruby]{
p [1, 0, 0, 1, 0].rindex(1) #=> 3
p [1, 0, 0, 0, 0].rindex(1) #=> 0
p [0, 0, 0, 0, 0].rindex(1) #=> nil
p [0, 1, 0, 1, 0].rindex {|v| v > 0......} #=> 3
//}
@see Array#index... -
String
# byteindex(pattern , offset = 0) -> Integer | nil (6208.0) -
文字列の offset から右に向かって pattern を検索し、 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...@raise IndexError オフセットが文字列の境界以外をさしているときに発生します。
//emlist[例][ruby]{
'foo'.byteindex('f') # => 0
'foo'.byteindex('o') # => 1
'foo'.byteindex('oo') # => 1
'foo'.byteindex('ooo') # => nil
'foo'.byteindex(/f/) # => 0
'foo'.byteindex(/o/) # =......index(/oo/) # => 1
'foo'.byteindex(/ooo/) # => nil
'foo'.byteindex('o', 1) # => 1
'foo'.byteindex('o', 2) # => 2
'foo'.byteindex('o', 3) # => nil
'foo'.byteindex('o', -1) # => 2
'foo'.byteindex('o', -2) # => 1
'foo'.byteindex('o', -3) # => 1
'foo'.byteindex('o', -4) # => nil
'あいう'.byteindex......('う') # => 6
'あいう'.byteindex('う', 3) # => 6
'あいう'.byteindex('う', -3) # => 6
'あいう'.byteindex('う', 1) # offset 1 does not land on character boundary (IndexError)
//}
@see String#index, String#byterindex... -
Socket
:: AncillaryData # ipv6 _ pktinfo _ ifindex -> Integer (6202.0) -
自身の type が IPV6_PKTINFO である場合、保持しているデータ (アドレス、インターフェースのインデックス) のインデックスを返します。
...ス)
のインデックスを返します。
require 'socket'
addr = Addrinfo.ip("::1")
ifindex = 0
ancdata = Socket::AncillaryData.ipv6_pktinfo(addr, ifindex)
p ancdata.ipv6_pktinfo_ifindex #=> 0
@see Socket::AncillaryData.ipv6_pktinfo,
Socket::AncillaryData#ipv6_pktinfo,
S... -
Socket
:: Ifaddr # ifindex -> Integer (6202.0) -
self のインターフェイスのインデックスを返します。
self のインターフェイスのインデックスを返します。 -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (6202.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...は正規表現で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索......String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("ing", -1......'foo'.byterindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil
'foo'.byterindex(/f/) # => 0
'foo'.byterindex(/o/) # => 2
'foo'.byterindex(/oo/) # => 1
'foo'.byterindex(/ooo/) # => nil
# 右でのマッチが優先
'foo'.byterindex(/o+/) # =... -
Array
# bsearch _ index -> Enumerator (6140.0) -
ブロックの評価結果で範囲内の各要素の判定を行い、条件を満たす値の位置を 二分探索(計算量は O(log n))で検索します。要素が見つからない場合は nil を返します。self はあらかじめソートしておく必要があります。
...rch_index { |x| x >= 4 } # => 1
ary.bsearch_index { |x| x >= 6 } # => 2
ary.bsearch_index { |x| x >= -1 } # => 0
ary.bsearch_index { |x| x >= 100 } # => nil
//}
//emlist[例: find-any モード][ruby]{
ary = [0, 4, 7, 10, 12]
# 4 <= v < 8 になる要素の位置を検索
ary.bsearch_index { |......x| 1 - x / 4 } # => 2
# 8 <= v < 10 になる要素の位置を検索
ary.bsearch_index { |x| 4 - x / 2 } # => nil
//}
@see Array#bsearch...