るりまサーチ

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. kernel $-i
  5. _builtin i

検索結果

<< 1 2 3 > >>

Singleton#clone (24001.0)

@raise TypeError このメソッドを呼び出した場合に発生します。

...@raise TypeError このメソッドを呼び出した場合に発生します。...

Singleton#dup (24001.0)

@raise TypeError このメソッドを呼び出した場合に発生します。

...@raise TypeError このメソッドを呼び出した場合に発生します。...

Object#define_singleton_method(symbol) { ... } -> Symbol (18339.0)

self に特異メソッド name を定義します。

...m symbol メソッド名を String または Symbol で指定します。

@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。

@return メソッド名を表す Symbol を返します。

//emlist[][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 (18339.0)

self に特異メソッド name を定義します。

...m symbol メソッド名を String または Symbol で指定します。

@param method Proc、Method あるいは UnboundMethod の
いずれかのインスタンスを指定します。

@return メソッド名を表す Symbol を返します。

//emlist[][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!"
//}...

BasicObject#singleton_method_undefined(name) -> object (15338.0)

特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。

...フックには
Module#method_undefined を使います。

@param name 未定義にされたメソッド名が Symbol で渡されます。

//emlist[例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end

obj = Foo.new
def obj.f...
...oo
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...

絞り込み条件を変える

Object#singleton_methods(inherited_too = true) -> [Symbol] (12338.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...そのオブジェクトに対して定義されている特異メソッド名
(public あるいは protected メソッド) の一覧を返します。

i
nherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追...
...

singleton
_methods(false) は、Object#methods(false) と同じです。

@param inherited_too 継承した特異メソッドを含める場合は真を、
そうでない場合は偽を指定します。

//emlist[例1][ruby]{
Parent = Class.new

class <<Parent
private;...
...def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end

Foo = Class.new(Parent)

class <<Foo
private; def private_class_foo() end
protected; def protected_class_foo() end
public; def public_class_foo() end
end

module B...

BasicObject#singleton_method_added(name) -> object (12232.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 (12232.0)

特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。

...//emlist[例][ruby]{
class Foo
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_metho...
...d_added,BasicObject#singleton_method_undefined...

Module#singleton_class? -> bool (12220.0)

self が特異クラスの場合に true を返します。そうでなければ false を返し ます。

...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。

//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}...

Object#singleton_class -> Class (12220.0)

レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。

...バが nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。

@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。

//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class...
...#=> #<Class:String>
nil.singleton_class #=> NilClass
//}

@see Object#class...

絞り込み条件を変える

<< 1 2 3 > >>