ライブラリ
クラス
-
ARGF
. class (126) - Array (312)
- Complex (24)
- Dir (19)
- Enumerator (151)
-
Enumerator
:: ArithmeticSequence (98) -
Enumerator
:: Chain (35) -
Enumerator
:: Lazy (298) -
Enumerator
:: Yielder (30) - Float (24)
-
Gem
:: SourceIndex (12) - Hash (168)
- IO (150)
- Matrix (86)
- Numeric (81)
- Object (63)
- OpenStruct (12)
- Pathname (63)
- Prime (12)
-
Prime
:: PseudoPrimeGenerator (36) -
Psych
:: Nodes :: Node (12) -
REXML
:: Parent (48) - Range (59)
- String (80)
- StringIO (81)
- Struct (43)
- Vector (74)
-
Zlib
:: GzipReader (36)
モジュール
- Enumerable (440)
- TSort (33)
キーワード
- % (14)
- + (7)
- << (12)
- == (7)
- ascend (12)
- begin (7)
- bsearch (24)
-
bsearch
_ index (10) - bytes (14)
- chain (7)
- chars (21)
- chunk (36)
-
chunk
_ while (21) - codepoints (21)
- collect (60)
- collect! (26)
- collect2 (12)
-
collect
_ concat (24) - combination (12)
- compact (4)
- cycle (24)
-
delete
_ if (36) - denominator (36)
- descend (12)
- detect (12)
-
drop
_ while (24) - each (292)
- each2 (12)
-
each
_ byte (60) -
each
_ char (48) -
each
_ child (31) -
each
_ codepoint (48) -
each
_ cons (12) -
each
_ entry (15) -
each
_ grapheme _ cluster (8) -
each
_ index (24) -
each
_ key (12) -
each
_ line (108) -
each
_ pair (36) -
each
_ slice (12) -
each
_ strongly _ connected _ component (11) -
each
_ strongly _ connected _ component _ from (11) -
each
_ value (12) -
each
_ with _ index (36) -
each
_ with _ object (12) - end (7)
-
enum
_ for (48) -
exclude
_ end? (7) - filter (28)
- filter! (14)
-
filter
_ map (6) - find (24)
-
find
_ all (12) -
find
_ index (36) - first (14)
-
flat
_ map (24) - force (12)
-
group
_ by (12) - gsub (12)
- gsub! (12)
- hash (7)
- index (24)
- inspect (14)
-
keep
_ if (24) - last (14)
- lazy (12)
- lines (49)
- map (60)
- map! (26)
-
max
_ by (24) -
min
_ by (24) -
minmax
_ by (12) - next (12)
-
next
_ values (12) - partition (12)
- peek (12)
-
peek
_ values (12) - permutation (12)
- reject (48)
- reject! (24)
-
repeated
_ combination (12) -
reverse
_ each (26) - rewind (7)
- rindex (12)
- select (60)
- select! (24)
- size (26)
-
slice
_ after (46) -
slice
_ before (60) -
slice
_ when (23) -
sort
_ by (12) -
sort
_ by! (12) - step (83)
-
take
_ while (48) - then (7)
-
to
_ enum (48) -
to
_ proc (6) -
transform
_ keys (8) -
transform
_ keys! (8) -
transform
_ values (9) -
transform
_ values! (9) -
tsort
_ each (11) -
with
_ index (36) -
with
_ object (36) - yield (12)
-
yield
_ self (8) - zip (24)
検索結果
先頭5件
-
Pathname
# each _ child(with _ directory = true) -> Enumerator (12301.0) -
self.children(with_directory).each と同じです。
...self.children(with_directory).each と同じです。
@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname......:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/usr/local/lib>
# => #<Pathname:/usr/local/opt>
# => #<Pathname:/usr/local/sbin>
# => #<Pathname:/usr/local/share>
# => #<Pathname:/usr/local/var>
Pathname("/usr/local").each_child(false) {|f| p f }
# => #<Pathname:bin>
# => #<Pat......hname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
# => #<Pathname:sbin>
# => #<Pathname:share>
# => #<Pathname:var>
//}
@see Pathname#children... -
Enumerator
:: Chain # each(*args) -> Enumerator (12207.0) -
まず最初の繰り返し可能なオブジェクトの each メソッドを args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト も同様に呼び出します。
...まず最初の繰り返し可能なオブジェクトの each メソッドを
args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト
も同様に呼び出します。
ブロックが渡されない場合は Enumerator を返します。... -
Enumerator
:: Chain # each(*args) { |*args| . . . } -> object (12107.0) -
まず最初の繰り返し可能なオブジェクトの each メソッドを args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト も同様に呼び出します。
...まず最初の繰り返し可能なオブジェクトの each メソッドを
args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト
も同様に呼び出します。
ブロックが渡されない場合は Enumerator を返します。... -
ARGF
. class # each _ char -> Enumerator (9308.0) -
レシーバに含まれる文字を一文字ずつブロックに渡して評価します。
...バに含まれる文字を一文字ずつブロックに渡して評価します。
このメソッドはスクリプトに指定した引数(Object::ARGV を参照) をファ
イル名とみなして、それらのファイルを連結した 1 つの仮想ファイルを表すオ
ブジェクト......ARGF.class#filename を使用します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを生成し
て返します。
例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt
# test.rb
ARGF.each_char......# => #<Enumerator: ARGF:each_char>
ARGF.each_char{|e|p e}
# => "l"
# "i"
# "n"
# "e"
# "1"
# "\n"
# "l"
# "i"
# "n"
# "e"
# "2"
# "\n"
@see IO#each_char... -
REXML
:: Parent # each _ child -> Enumerator (9307.0) -
各子ノードに対しブロックを呼び出します。
...各子ノードに対しブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。... -
StringIO
# each _ char -> Enumerator (9303.0) -
自身に含まれる文字を一文字ずつブロックに渡して評価します。
...自身に含まれる文字を一文字ずつブロックに渡して評価します。
自身は読み込み用にオープンされていなければなりません。
@raise IOError 自身が読み込み用にオープンされていない場合に発生します。
@see IO#each_char... -
Struct
# select -> Enumerator (9213.0) -
構造体のメンバの値に対してブロックを評価した値が真であった要素を全て含 む配列を返します。真になる要素がひとつもなかった場合は空の配列を返しま す。
...ロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
Lots = Struct.new(:a, :b, :c, :d, :e, :f)
l = Lots.new(11, 22, 33, 44, 55, 66)
l.select {|v| (v % 2).zero? } #=> [22, 44, 66]
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタン......スに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see Enumerable#select... -
Enumerator
# with _ object(obj) -> Enumerator (9207.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...、
最後に obj を返す Enumerator を返します。
//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end
to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{str......ing}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}
@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object... -
Enumerator
# with _ object(obj) {|(*args) , memo _ obj| . . . } -> object (9207.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...、
最後に obj を返す Enumerator を返します。
//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end
to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{str......ing}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}
@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object... -
Enumerator
:: Yielder # to _ proc -> Proc (9207.0) -
Enumerator.new で使うメソッドです。
...Enumerator.new で使うメソッドです。
引数を Enumerator::Yielder#yield に渡す Proc を返します。
これは Enumerator::Yielder オブジェクトを他のメソッドにブロック引数と
して直接渡すために使えます。
//emlist[例][ruby]{
text = <<-END
Hello
こ......んにちは
END
enum = Enumerator.new do |y|
text.each_line(&y)
end
enum.each do |line|
p line
end
# => "Hello\n"
# "こんにちは\n"
//}... -
Psych
:: Nodes :: Node # each -> Enumerator (9207.0) -
self のノードをルートとする部分木の各ノードを引数として ブロックを呼び出します。
...self のノードをルートとする部分木の各ノードを引数として
ブロックを呼び出します。
ブロックを省略した場合は Enumerator を返します。...