7件ヒット
[1-7件を表示]
(0.107秒)
モジュール
- Enumerable (4)
キーワード
- each (2)
-
each
_ entry (2) - include? (1)
- member? (1)
検索結果
先頭5件
-
Module
# include(*mod) -> self (54523.0) -
モジュール mod をインクルードします。
モジュール mod をインクルードします。
@param mod Module のインスタンス( Enumerable など)を指定します。
@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。
//emlist[例][ruby]{
module M
end
module M2
include M
end
module M
include M2
end
//}
実行結果:
-:3:in `append_features': cyclic include detected (ArgumentError)
... -
Enumerable
# include?(val) -> bool (45343.0) -
val と == の関係にある要素を含むとき真を返します。
val と == の関係にある要素を含むとき真を返します。
@param val 任意のオブジェクト
//emlist[例][ruby]{
[2, 4, 6].include? 2 #=> true
[2, 4, 6].include? 1 #=> false
[2, 4, 6].member? 2 #=> true
[2, 4, 6].member? 1 #=> false
//} -
Enumerable
# member?(val) -> bool (36043.0) -
val と == の関係にある要素を含むとき真を返します。
val と == の関係にある要素を含むとき真を返します。
@param val 任意のオブジェクト
//emlist[例][ruby]{
[2, 4, 6].include? 2 #=> true
[2, 4, 6].include? 1 #=> false
[2, 4, 6].member? 2 #=> true
[2, 4, 6].member? 1 #=> false
//} -
Enumerable
# each _ entry -> Enumerator (27058.0) -
ブロックを各要素に一度ずつ適用します。
ブロックを各要素に一度ずつ適用します。
一要素として複数の値が渡された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返されます。
@see Enumerable#slice_before -
Enumerable
# each _ entry {|obj| block} -> self (27058.0) -
ブロックを各要素に一度ずつ適用します。
ブロックを各要素に一度ずつ適用します。
一要素として複数の値が渡された場合はブロックには配列として渡されます。
//emlist[例][ruby]{
class Foo
include Enumerable
def each
yield 1
yield 1,2
end
end
Foo.new.each_entry{|o| print o, " -- "}
# => 1 -- [1, 2] --
//}
ブロックを省略した場合は Enumerator が返されます。
@see Enumerable#slice_before -
Vector
# each -> Enumerator (58.0) -
ベクトルの各要素をブロックの引数として順にブロックを呼び出します。
ベクトルの各要素をブロックの引数として順にブロックを呼び出します。
このクラスは Enumerable を include しているため、
このメソッドを経由して Enumerable の各メソッドを使うことができます。
ブロックを省略した場合は Enumerator を返します。 -
Vector
# each {|e| . . . } -> self (58.0) -
ベクトルの各要素をブロックの引数として順にブロックを呼び出します。
ベクトルの各要素をブロックの引数として順にブロックを呼び出します。
このクラスは Enumerable を include しているため、
このメソッドを経由して Enumerable の各メソッドを使うことができます。
ブロックを省略した場合は Enumerator を返します。