るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.129秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:string[x] > クエリ:class[x] > クラス:UnboundMethod[x]

別のキーワード

  1. string []=
  2. string slice
  3. string []
  4. string slice!
  5. string gsub

ライブラリ

検索結果

UnboundMethod#arity -> Integer (32.0)

メソッドが受け付ける引数の数を返します。

...ます。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。

//emlist[例][ruby]{
class
C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
def five(a, b, *c); end
def six(a, b, *c, &d); end
end

p C...
...).arity #=> 2
p C.instance_method(:five).arity #=> -3
p C.instance_method(:six).arity #=> -3


String
.instance_method(:size).arity #=> 0
String
.instance_method(:replace).arity #=> 1
String
.instance_method(:squeeze).arity #=> -1
String
.instance_method(:count).arity #=> -1
//}...