るりまサーチ

最速Rubyリファレンスマニュアル検索!
55件ヒット [1-55件を表示] (0.134秒)
トップページ > クエリ:_builtin[x] > ライブラリ:ビルトイン[x] > クエリ:E[x] > クエリ:__method__[x]

別のキーワード

  1. _builtin __send__
  2. delegate __getobj__
  3. delegate __setobj__
  4. basicobject __send__
  5. weakref __setobj__

クラス

モジュール

キーワード

検索結果

Kernel.#__method__ -> Symbol | nil (32215.0)

現在のメソッド名を返します。 メソッドの外で呼ばれると nil を返します。

...のメソッド名を返します。
メソッドの外で呼ばれると nil を返します。

//emlist[例][ruby]{
def foo
p __method__
e
nd
alias :bar :foo
foo #=> :foo
bar #=> :foo
p __method__ #=> nil
//}

現在のメソッド名が alias されたメソッドの場合でも alias 元のメ...

Object#enum_for(method = :each, *args) -> Enumerator (14208.0)

Enumerator.new(self, method, *args) を返します。

...
E
numerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...//emlist[][ruby]{
str = "xyz"

e
num = 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[例(ブロックを指定する場合)][ruby]{
module Enumerable...
...ef repeat(n)
raise 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
e
nd
e
...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (14208.0)

Enumerator.new(self, method, *args) を返します。

...
E
numerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...//emlist[][ruby]{
str = "xyz"

e
num = 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[例(ブロックを指定する場合)][ruby]{
module Enumerable...
...ef repeat(n)
raise 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
e
nd
e
...

Object#to_enum(method = :each, *args) -> Enumerator (14208.0)

Enumerator.new(self, method, *args) を返します。

...
E
numerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...//emlist[][ruby]{
str = "xyz"

e
num = 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[例(ブロックを指定する場合)][ruby]{
module Enumerable...
...ef repeat(n)
raise 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
e
nd
e
...

Object#to_enum(method = :each, *args) {|*args| ... } -> Enumerator (14208.0)

Enumerator.new(self, method, *args) を返します。

...
E
numerator.new(self, method, *args) を返します。

ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。


@param method メソッド名の文字列かシンボルです。
@param args 呼び出...
...//emlist[][ruby]{
str = "xyz"

e
num = 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[例(ブロックを指定する場合)][ruby]{
module Enumerable...
...ef repeat(n)
raise 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
e
nd
e
...

絞り込み条件を変える