22件ヒット
[1-22件を表示]
(0.024秒)
検索結果
-
Module
# undef _ method(*name) -> self (21044.0) -
このモジュールのインスタンスメソッド name を未定義にします。
...か Symbol を指定します。
@raise NameError 指定したインスタンスメソッドが定義されていない場合に発生します。
=== 「未定義にする」とは
このモジュールのインスタンスに対して name という
メソッドを呼び出すことを禁止す......い。
//emlist[例][ruby]{
class A
def ok
puts 'A'
end
end
class B < A
def ok
puts 'B'
end
end
B.new.ok # => B
# undef_method の場合はスーパークラスに同名のメソッドがあっても
# その呼び出しはエラーになる
class B
undef_method :ok
end
B.new.......ッドがあると
# それが呼ばれる
class B
remove_method :ok
end
B.new.ok # => A
//}
また、undef 文と undef_method の違いは、
メソッド名を String または Symbol で与えられることです。
//emlist[例][ruby]{
module M1
def foo
end
def self.moo
undef f... -
Object
# ===(other) -> bool (18126.0) -
case 式で使用されるメソッドです。d:spec/control#case も参照してください。
...when 節の式をレシーバーとして === を呼び出すことに注意してください。
また Enumerable#grep でも使用されます。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =......nce of String class. But don't hit."
else
"unknown"
end
end
puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}
@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#...