429件ヒット
[1-100件を表示]
(0.024秒)
クラス
- Array (24)
- BasicObject (36)
- Hash (24)
- Module (72)
- Object (84)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- clone (24)
-
define
_ singleton _ method (24) - dup (24)
-
initialize
_ copy (12) -
irb
/ completion (12) -
method
_ added (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
-
private
_ class _ method (24) -
rb
_ singleton _ class (12) -
rb
_ singleton _ class _ attached (12) -
rb
_ singleton _ class _ clone (12) -
rb
_ singleton _ class _ new (12) -
ruby 1
. 8 . 3 feature (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) - クラス/メソッドの定義 (12)
検索結果
先頭5件
-
Singleton (38058.0)
-
Singleton パターンを提供するモジュールです。
...Singleton パターンを提供するモジュールです。
Mix-in により singleton パターンを提供します。
Singleton モジュールを include することにより、クラスは
高々ひとつのインスタンスしか持たないことが保証されます。
Singleton を M......e 'singleton'
class SomeSingletonClass
include Singleton
#....
end
a = SomeSingletonClass.instance
b = SomeSingletonClass.instance # a and b are same object
p [a,b] # => [#<SomeSingletonClass:0x0000562e6e18ddd0>, #<SomeSingletonClass:0x0000562e6e18ddd0>]
a = SomeSingletonClass.n......ew # => NoMethodError (private method `new' called for SomeSingletonClass:Class)... -
Object
# singleton _ class -> Class (12357.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...れ 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... -
Module
# singleton _ class? -> bool (12244.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}... -
VALUE rb
_ singleton _ class(VALUE obj) (12200.0) -
obj に特異クラスを導入し、その特異クラスを返します。 すでに特異クラスが導入されているときはそれをそのまま返します。
obj に特異クラスを導入し、その特異クラスを返します。
すでに特異クラスが導入されているときはそれをそのまま返します。
obj が特異メソッドを定義できない型のオブジェクトである
ときは例外 TypeError を発生します。 -
VALUE rb
_ singleton _ class _ clone(VALUE klass) (12200.0) -
特異クラス klass を clone して返します。 klass が特異クラスでないときはただ klass を返します。
特異クラス klass を clone して返します。
klass が特異クラスでないときはただ klass を返します。 -
VALUE rb
_ singleton _ class _ new(VALUE super) (12200.0) -
super をスーパークラスとする特異クラスを生成し、返します。
super をスーパークラスとする特異クラスを生成し、返します。 -
void rb
_ singleton _ class _ attached(VALUE klass , VALUE obj) (12200.0) -
特異クラス klass にその唯一のインスタンス obj を結びつけます。
特異クラス klass にその唯一のインスタンス obj を結びつけます。 -
Object
# singleton _ methods(inherited _ too = true) -> [Symbol] (6245.0) -
そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。
...加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。
singleton_methods(false) は、Object#methods(false) と同じです。
@param inherited_too 継承した特異メソッ......by]{
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 Bar
private; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end
obj = Foo.new
class <<obj
include Bar
private; def private_self() end
protected; def protected_self() end
public;... -
BasicObject
# singleton _ method _ undefined(name) -> object (6149.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...][ruby]{
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...