55件ヒット
[1-55件を表示]
(0.093秒)
検索結果
先頭5件
-
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (367.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......に渡される引数です。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する......aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*v... -
Object
# to _ enum(method = :each , *args) {|*args| . . . } -> Enumerator (367.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......に渡される引数です。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する......aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*v... -
Object
# enum _ for(method = :each , *args) -> Enumerator (267.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......に渡される引数です。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する......aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*v... -
Object
# to _ enum(method = :each , *args) -> Enumerator (267.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......に渡される引数です。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する......aise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*v... -
Object
:: DATA -> File (137.0) -
スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。
...スクリプトの __END__
プログラムの終り以降をアクセスする File オブジェクト。
d:spec/program#terminateも参照。
ソースファイルの __END__ 以降は解析・実行の対象にならないので
その部分にプログラムが利用するためのデータを......File オブジェクトを保持しています。
__END__ を含まないプログラムにおいては DATA は定義されません。
=== 注意
* DATA.rewind で移動する読みとり位置は __END__ 直後ではなく、
スクリプトファイルの先頭です。
* ス......。
* スクリプトがファイルや標準入力から読みこまれなかった場合や、
__END__ で終っていない場合には定義されません。
* Kernel.#require や Kernel.#load で
読み込まれたファイルの中であってもそのファイル (__FILE_...