ライブラリ
- ビルトイン (1425)
- benchmark (60)
-
net
/ imap (12) - rss (1356)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - win32ole (24)
クラス
- Array (529)
-
Benchmark
:: Job (24) -
Benchmark
:: Report (36) - Dir (38)
-
Enumerator
:: Lazy (155) -
Net
:: IMAP (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) - WIN32OLE (24)
モジュール
- Enumerable (634)
-
RSS
:: ImageItemModel (24)
キーワード
- % (14)
- [] (12)
- []= (12)
- about (24)
- about= (24)
- all? (45)
- 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 (72)
-
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 (18)
-
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
_ category (12) -
new
_ item (12) - none? (45)
- one? (45)
- pubDate (24)
- pubDate= (24)
- reduce (36)
- reject (60)
- report (24)
- resource (12)
- resource= (12)
- resources (12)
-
reverse
_ each (24) - rindex (36)
- 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 (24)
- url (48)
- url= (48)
- width (12)
- width= (12)
検索結果
先頭5件
-
Array
# keep _ if -> Enumerator (8.0) -
ブロックが真を返した要素を残し、偽を返した要素を自身から削除します。
...a b c d e f }
a.keep_if {|v| v =~ /[a-z]/ } # => ["a", "b", "c", "d", "e", "f"]
a # => ["a", "b", "c", "d", "e", "f"]
//}
ブロックが与えられなかった場合は、自身と keep_if から生成した
Enumerator オブジェクトを返します。
@see Array#select!, Array#delete_if... -
Array
# reject -> Enumerator (8.0) -
各要素に対してブロックを評価し、 その値が偽であった要素を集めた新しい配列を返します。 条件を反転させた select です。
...を返します。
条件を反転させた select です。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# 偶数を除外する (奇数を集める)
[1, 2, 3, 4, 5, 6].reject {|i| i % 2 == 0 } # => [1, 3, 5]
//}
@see Array#select, Enumerable#reject... -
Array
# reverse _ each -> Enumerator (8.0) -
各要素に対して逆順にブロックを評価します。
...て逆順にブロックを評価します。
ブロックが与えられなかった場合は、自身と reverse_each から生成した
Enumerator オブジェクトを返します。
//emlist[例][ruby]{
a = [ "a", "b", "c" ]
a.reverse_each {|x| print x, " " }
# => c b a
//}
@see Array#each... -
Array
# select! -> Enumerator (8.0) -
ブロックが真を返した要素を残し、偽を返した要素を自身から削除します。 変更があった場合は self を、 変更がなかった場合には nil を返します。
...//emlist[例][ruby]{
a = %w{ a b c d e f }
a.select! {|v| v =~ /[a-z]/ } # => nil
a # => ["a", "b", "c", "d", "e", "f"]
//}
ブロックが与えられなかった場合は、自身と select! から生成した
Enumerator オブジェクトを返します。
@see Array#keep_if, Array#reject!... -
Array
# sort _ by! -> Enumerator (8.0) -
sort_by の破壊的バージョンです。
...sort_by の破壊的バージョンです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
fruits = %w{apple pear fig}
fruits.sort_by! { |word| word.length }
fruits # => ["fig", "pear", "apple"]
//}
@see Enumerable#sort_by... -
Dir
# each -> Enumerator (8.0) -
ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。
...。
ブロックが与えられなかった場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に自身が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each{|f|
p f
}
#=> "."
# ".."
#... -
Enumerable
# any? -> bool (8.0) -
すべての要素が偽である場合に false を返します。 真である要素があれば、ただちに true を返します。
...by]{
require 'set'
p Set[1, 2, 3].any? {|v| v > 3 } # => false
p Set[1, 2, 3].any? {|v| v > 1 } # => true
p Set[].any? {|v| v > 0 } # => false
p Set[nil, true, 99].any? # => true
p Set[].any? # => false
//}
@see Array#any?... -
Enumerable
# filter _ map -> Enumerator (8.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
# sort _ by -> Enumerator (8.0) -
ブロックの評価結果を <=> メソッドで比較することで、self を昇 順にソートします。ソートされた配列を新たに生成して返します。
...できます。
//emlist[][ruby]{
i = 0
ary.sort_by {|v| [v, i += 1] }
//}
※ 比較結果が同じ要素は元の順序通りに並ぶソートを
「安定なソート (stable sort)」と言います。
ブロックを省略した場合は Enumerator を返します。
@see Enumerable#sort... -
Enumerable
# uniq -> Array (8.0) -
self から重複した値を取り除いた配列を返します。
...[ruby]{
olympics = {
1896 => 'Athens',
1900 => 'Paris',
1904 => 'Chicago',
1906 => 'Athens',
1908 => 'Rome',
}
olympics.uniq{|k,v| v} # => [[1896, "Athens"], [1900, "Paris"], [1904, "Chicago"], [1908, "Rome"]]
(1..100).uniq{|x| (x**2) % 10 } # => [1, 2, 3, 4, 5, 10]
//}
@see Array#uniq......][ruby]{
olympics = {
1896 => 'Athens',
1900 => 'Paris',
1904 => 'Chicago',
1906 => 'Athens',
1908 => 'Rome',
}
olympics.uniq{|k,v| v} # => [[1896, "Athens"], [1900, "Paris"], [1904, "Chicago"], [1908, "Rome"]]
(1..100).uniq{|x| (x**2) % 10 } # => [1, 2, 3, 4, 5, 10]
//}
@see Array#uniq... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (8.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
...erator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}
@see Enumerable#take_while... -
Range
# each -> Enumerator (8.0) -
範囲内の要素に対して繰り返します。
...に対して繰り返します。
Range#each は各要素の succ メソッドを使用してイテレーションするようになりました。
@raise TypeError succ メソッドを持たないクラスの範囲オブジェクトに対してこのメソッドを呼んだ場合に発生しま...