324件ヒット
[1-100件を表示]
(0.013秒)
ライブラリ
- ビルトイン (108)
- forwardable (72)
- openssl (12)
- psych (12)
-
rdoc
/ context (72) -
rdoc
/ top _ level (24) - singleton (24)
クラス
- BasicObject (36)
- Module (12)
- Object (60)
-
OpenSSL
:: SSL :: SSLContext (12) -
Psych
:: Handler (12) -
RDoc
:: Context (72) -
RDoc
:: TopLevel (24)
モジュール
- SingleForwardable (72)
- Singleton (24)
キーワード
-
add
_ class (12) -
add
_ class _ or _ module (24) -
add
_ module (12) - classes (12)
- clone (12)
-
def
_ delegator (12) -
def
_ delegators (12) -
def
_ single _ delegator (12) -
def
_ single _ delegators (12) -
define
_ singleton _ method (24) - delegate (12)
- dup (12)
-
each
_ classmodule (12) -
find
_ local _ symbol (12) - scalar (12)
-
set
_ visibility _ for (12) -
single
_ delegate (12) -
singleton
_ class (12) -
singleton
_ class? (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12)
検索結果
先頭5件
-
SingleForwardable
# def _ single _ delegator(accessor , method , ali = method) -> () (6102.0) -
メソッドの委譲先を設定します。
...のオブジェクトの method へ処理が委譲されるようになります。
委譲元と委譲先のメソッド名が同じ場合は, ali を省略することが可能です。
def_delegator は def_singleton_delegator の別名になります。
@see SingleForwardable#def_delegators... -
SingleForwardable
# def _ single _ delegators(accessor , *methods) -> () (6102.0) -
メソッドの委譲先をまとめて設定します。
..._delegators は def_singleton_delegators の別名になります。
また、以下の 2 つの例は同じ意味です。
def_delegators :@records, :size, :<<, :map
def_delegator :@records, :size
def_delegator :@records, :<<
def_delegator :@records, :map
@see SingleForwardable#def_dele... -
SingleForwardable
# single _ delegate(hash) -> () (6102.0) -
メソッドの委譲先を設定します。
メソッドの委譲先を設定します。
@param hash 委譲先のメソッドがキー、委譲先のオブジェクトが値の
Hash を指定します。キーは Symbol、
String かその配列で指定します。
@see Forwardable#delegate -
BasicObject
# singleton _ method _ added(name) -> object (6101.0) -
特異メソッドが追加された時にインタプリタから呼び出されます。
...emlist[例][ruby]{
class Foo
def singleton_method_added(name)
puts "singleton method \"#{name}\" was added"
end
end
obj = Foo.new
def obj.foo
end
#=> singleton method "foo" was added
//}
@see Module#method_added,BasicObject#singleton_method_removed,BasicObject#singleton_method_undefined... -
BasicObject
# singleton _ method _ removed(name) -> object (6101.0) -
特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。
...def singleton_method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end
obj = Foo.new
def obj.foo
end
class << obj
remove_method :foo
end
#=> singleton method "foo" was removed
//}
@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_m... -
BasicObject
# singleton _ method _ undefined(name) -> object (6101.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo" was undefined
# singleton method "bar"......was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef... -
Module
# singleton _ class? -> bool (6101.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}... -
Object
# define _ singleton _ method(symbol) { . . . } -> Symbol (6101.0) -
self に特異メソッド name を定義します。
...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}... -
Object
# define _ singleton _ method(symbol , method) -> Symbol (6101.0) -
self に特異メソッド name を定義します。
...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"
guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}...