ライブラリ
- ビルトイン (1551)
- benchmark (60)
-
net
/ imap (48) - openssl (12)
- rss (1704)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - win32ole (48)
クラス
- Array (589)
-
Benchmark
:: Job (24) -
Benchmark
:: Report (36) - Dir (38)
-
Enumerator
:: Lazy (173) - File (12)
-
Net
:: IMAP (12) -
Net
:: IMAP :: MailboxACLItem (24) -
OpenSSL
:: ASN1 :: Constructive (12) -
RSS
:: ImageItemModel :: ImageItem (168) -
RSS
:: Maker :: ItemsBase (60) -
RSS
:: Maker :: ItemsBase :: ItemBase (216) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Categories (12) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Enclosure (72) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Guid (48) -
RSS
:: Maker :: RSS20 :: Items :: Item :: Source (48) -
RSS
:: Maker :: RSSBase (12) -
RSS
:: RDF (36) -
RSS
:: RDF :: Channel (24) -
RSS
:: RDF :: Channel :: Items (12) -
RSS
:: RDF :: Item (120) -
RSS
:: Rss (12) -
RSS
:: Rss :: Channel (36) -
RSS
:: Rss :: Channel :: Item (276) -
RSS
:: Rss :: Channel :: Item :: Category (48) -
RSS
:: Rss :: Channel :: Item :: Enclosure (72) -
RSS
:: Rss :: Channel :: Item :: Guid (12) -
RSS
:: Rss :: Channel :: Item :: Source (48) - Range (69)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) -
Thread
:: Queue (4) - WIN32OLE (24)
-
WIN32OLE
_ VARIANT (12)
モジュール
- Enumerable (666)
-
RSS
:: ImageItemModel (24)
キーワード
- % (14)
- Categories (24)
- CategoriesBase (12)
- Category (12)
- Enclosure (36)
- EnclosureBase (12)
- Guid (36)
- GuidBase (12)
- ImageItem (12)
- ImageItemModel (12)
- Item (60)
- ItemBase (12)
- Items (48)
- ItemsBase (12)
- MailboxACLItem (12)
- Source (36)
- SourceBase (12)
-
WIN32OLE
_ VARIANT (12) - [] (24)
- []= (12)
- about (24)
- about= (24)
- all? (53)
- any? (62)
- categories (24)
- category (12)
- category= (12)
- chunk (12)
- collect (60)
- collect! (24)
-
collect
_ concat (12) - comments (24)
- comments= (24)
- content (48)
- content= (48)
- count (72)
- date (48)
- date= (48)
- description (36)
- description= (36)
- detect (24)
-
do
_ sort (12) -
do
_ sort= (12) - domain (12)
- domain= (12)
-
drop
_ while (12) - each (84)
-
each
_ child (14) -
each
_ with _ index (24) - enclosure (24)
- enclosure= (12)
- filter (35)
- filter! (14)
-
filter
_ map (18) - find (24)
-
find
_ all (36) -
find
_ index (36) -
flat
_ map (12) - getacl (12)
- grep (36)
-
grep
_ v (34) - guid (24)
- guid= (12)
- height (12)
- height= (12)
-
image
_ height (12) -
image
_ height= (12) -
image
_ item (12) -
image
_ item= (12) -
image
_ width (12) -
image
_ width= (12) - index (36)
- inject (36)
- isPermaLink (24)
- isPermaLink= (12)
- item= (24)
- items (60)
- items= (12)
- join (30)
-
keep
_ if (24) - length (24)
- length= (24)
- link (36)
- link= (36)
- list (12)
- map (60)
- map! (24)
-
max
_ by (48) -
max
_ size (12) -
max
_ size= (12) -
min
_ by (48) - new (16)
-
new
_ category (12) -
new
_ item (12) - none? (45)
- one? (45)
- partition (24)
- pubDate (24)
- pubDate= (24)
-
rb
_ ary _ delete (12) -
rb
_ ary _ includes (12) -
rb
_ ary _ push (12) -
rb
_ ary _ unshift (12) - reduce (36)
- reject (60)
- report (24)
- resource (12)
- resource= (12)
- resources (12)
-
reverse
_ each (24) - rights (12)
- rindex (36)
- rss (12)
-
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 5 feature (12) - select (60)
- select! (24)
-
sort
_ by (24) -
sort
_ by! (24) - source (24)
- source= (12)
- step (31)
-
take
_ while (24) - title (36)
- title= (36)
- type (24)
- type= (24)
- uniq (66)
- uniq! (24)
- url (48)
- url= (48)
- user (12)
- width (12)
- width= (12)
検索結果
先頭5件
-
Enumerable
# each _ with _ index(*args) -> Enumerator (1.0) -
要素とそのインデックスをブロックに渡して繰り返します。
要素とそのインデックスをブロックに渡して繰り返します。
ブロックを省略した場合は、
要素とそのインデックスを繰り返すような
Enumerator を返します。
Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。
@param args イテレータメソッド (each など) にそのまま渡されます。
//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
#... -
Enumerable
# filter _ map -> Enumerator (1.0) -
各要素に対してブロックを評価した値のうち、真であった値の 配列を返します。
各要素に対してブロックを評価した値のうち、真であった値の
配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
(1..10).filter_map { |i| i * 2 if i.even? } #=> [4, 8, 12, 16, 20]
//}
@see Enumerable#filter, Enumerable#map -
Enumerable
# partition -> Enumerator (1.0) -
各要素を、ブロックの条件を満たす要素と満たさない要素に分割します。 各要素に対してブロックを評価して、その値が真であった要素の配列と、 偽であった要素の配列の 2 つを配列に入れて返します。
各要素を、ブロックの条件を満たす要素と満たさない要素に分割します。
各要素に対してブロックを評価して、その値が真であった要素の配列と、
偽であった要素の配列の 2 つを配列に入れて返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].partition {|i| i % 3 == 0 }
#=> [[9, 6, 3, 0], [10, 8, 7, 5, 4, 2, 1]]
//} -
Enumerable
# reject -> Enumerator (1.0) -
各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。
各要素に対してブロックを評価し、
その値が偽であった要素を集めた新しい配列を返します。
条件を反転させた select です。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
(1..6).reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}
@see Enumerable#select, Array#reject
@see Enumerable#grep_v -
Enumerable
# sort _ by -> Enumerator (1.0) -
ブロックの評価結果を <=> メソッドで比較することで、self を昇 順にソートします。ソートされた配列を新たに生成して返します。
ブロックの評価結果を <=> メソッドで比較することで、self を昇
順にソートします。ソートされた配列を新たに生成して返します。
つまり、以下とほぼ同じ動作をします。
//emlist[例][ruby]{
class Array
def sort_by
self.map {|i| [yield(i), i] }.
sort {|a, b| a[0] <=> b[0] }.
map {|i| i[1]}
end
end
//}
Enumerable#sort と比較して sort_by が優れている点として、
比較条件が複雑な場合の速度が挙... -
Enumerable
# uniq -> Array (1.0) -
self から重複した値を取り除いた配列を返します。
self から重複した値を取り除いた配列を返します。
ブロックが与えられた場合、ブロックが返した値が重複した要素を取り除いた
配列を返します。
//emlist[例][ruby]{
olympics = {
1896 => 'Athens',
1900 => 'Paris',
1904 => 'Chicago',
1906 => 'Athens',
1908 => 'Rome',
}
olympics.uniq{|k,v| v} # => [[1896, "Athens"], [1900, "Paris"], [1904, "Chicago"], [1908, "Ro... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (1.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Enumerator
:: Lazy # uniq -> Enumerator :: Lazy (1.0) -
Enumerable#uniq と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#uniq と同じですが、配列ではなく Enumerator::Lazy を返します。 -
Range
# %(s) -> Enumerator (1.0) -
範囲内の要素を s おきに繰り返します。
範囲内の要素を s おきに繰り返します。
@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# ... -
Range
# %(s) -> Enumerator :: ArithmeticSequence (1.0) -
範囲内の要素を s おきに繰り返します。
範囲内の要素を s おきに繰り返します。
@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# ... -
Range
# each -> Enumerator (1.0) -
範囲内の要素に対して繰り返します。
範囲内の要素に対して繰り返します。
Range#each は各要素の succ メソッドを使用してイテレーションするようになりました。
@raise TypeError succ メソッドを持たないクラスの範囲オブジェクトに対してこのメソッドを呼んだ場合に発生します。
//emlist[例][ruby]{
(10..15).each {|n| print n, ' ' }
# prints: 10 11 12 13 14 15
(2.5..5).each {|n| print n, ' ' }
# raises: TypeError: can't iterate from Floa...