3件ヒット
[1-3件を表示]
(0.046秒)
キーワード
- Bignum (1)
- Fixnum (1)
- UnboundMethod (1)
検索結果
先頭3件
-
Bignum (58.0)
-
Alias of Integer
Alias of Integer -
Fixnum (58.0)
-
Alias of Integer
Alias of Integer -
UnboundMethod (28.0)
-
レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。
...とができます。
//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end
# 任意のキーとメソッドの関係をハッシュに保持して......mlist[例: 以下はメソッドの再定義を UnboundMethod を使って行う方法です。普通は alias や super を使います。][ruby]{
class Foo
def foo
p :foo
end
@@orig_foo = instance_method :foo
def foo
p :bar
@@orig_foo.bind(self).call
end
end
Foo.new.foo
# =...