別のキーワード
ライブラリ
- ビルトイン (268)
- forwardable (44)
- profiler (6)
-
rdoc
/ context (11) - singleton (44)
クラス
- Array (22)
- BasicObject (33)
- Hash (22)
- Module (59)
- Object (121)
-
RDoc
:: Context (11)
モジュール
- SingleForwardable (44)
- Singleton (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Numeric (11)
-
Profiler
_ _ (6) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Ruby用語集 (11)
- Singleton (11)
- clone (33)
-
def
_ delegator (11) -
def
_ delegators (11) -
def
_ single _ delegator (11) -
def
_ single _ delegators (11) -
define
_ singleton _ method (22) - dup (33)
-
initialize
_ copy (11) - instance (11)
-
irb
/ completion (11) - method (11)
-
method
_ added (11) -
method
_ removed (11) -
method
_ undefined (11) - methods (11)
-
private
_ class _ method (15) -
private
_ methods (11) -
protected
_ methods (11) -
public
_ methods (11) -
rb
_ define _ singleton _ method (11) -
rb
_ obj _ singleton _ methods (11) -
rb
_ singleton _ class (11) -
rb
_ singleton _ class _ attached (11) -
rb
_ singleton _ class _ clone (11) -
rb
_ singleton _ class _ new (11) -
rdoc
/ parser / ruby (11) -
ruby 1
. 8 . 3 feature (11) -
set
_ visibility _ for (11) -
singleton
_ class (11) -
singleton
_ class? (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
void rb
_ define _ singleton _ method(VALUE obj , const char *name , VALUE (*func)() , int argc) (6100.0) -
obj に特異メソッド name を定義します。 メソッドの実体を func に関数ポインタで与え、その関数がとる 引数のタイプを argc に渡します。argc のフォーマットに ついては rb_define_method の記述を参照してください。
obj に特異メソッド name を定義します。
メソッドの実体を func に関数ポインタで与え、その関数がとる
引数のタイプを argc に渡します。argc のフォーマットに
ついては rb_define_method の記述を参照してください。 -
void rb
_ singleton _ class _ attached(VALUE klass , VALUE obj) (6100.0) -
特異クラス klass にその唯一のインスタンス obj を結びつけます。
特異クラス klass にその唯一のインスタンス obj を結びつけます。 -
RDoc
:: Context # set _ visibility _ for(methods , visibility , singleton = false) -> () (123.0) -
methods で指定した RDoc::AnyMethod、RDoc::Attr の内、 singleton で指定した条件と一致するメソッドすべての可視性を visibility に設定します。
...methods で指定した RDoc::AnyMethod、RDoc::Attr の内、
singleton で指定した条件と一致するメソッドすべての可視性を visibility
に設定します。
@param methods RDoc::AnyMethod、RDoc::Attr オブジェクトの配
列を指定します。
@param vi......sibility 可視性を :public, :protected, :private の内のいずれか
で指定します。
@param singleton 特異メソッドの可視性を変更する場合は true、そうでない
場合は false を指定します。... -
Object
# methods(include _ inherited = true) -> [Symbol] (96.0) -
そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。
...ソッドの名前を返します。
ただし特別に、引数が偽の時は Object#singleton_methods(false) と同じになっています。
@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じになります。
//emlist[例1][ruby]{
class Parent
privat......) end
public; def public_foo() end
end
obj = Foo.new
class <<obj
private; def private_singleton() end
protected; def protected_singleton() end
public; def public_singleton() end
end
# あるオブジェクトの応答できるメソッドの一覧を得る。
p obj.me......e)
p obj.private_methods(false)
p obj.protected_methods(false)
# 実行結果
[:protected_singleton, :public_singleton]
[:public_singleton, :public_foo]
[:private_singleton, :private_foo]
[:protected_singleton, :protected_foo]
//}
//emlist[例2][ruby]{
# あるオブジェクトの応答できる... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (78.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...ect#object_id|Object/object_id>)) [new]
追加 (Object#id は、obsolete)
: ((<Object#singleton_method_removed|Object/singleton_method_removed>)) [new]
: ((<Object#singleton_method_undefined|Object/singleton_method_undefined>)) [new]
追加
=== Proc
: ((<Proc#binding|Proc/binding>)) [new]......を指定できるようになりました。((<RCR#146>))
: ((<Module#method_added|Module/method_added>)) [compat]
: ((<Module#singleton_method_added|Module/singleton_method_added>)) [compat]
拡張ライブラリからメソッドが定義されたときも呼ばれるようになりました......eric
: ((<Numeric#step|Numeric/step>)) [compat]
((<Fixnum>)), ((<Integer>)) から移動しました。
=== Object
: ((<Object#singleton_methods|Object/singleton_methods>)) [compat]
省略可能な引数 all が追加されました。
: ((<Object#methods|Object/methods>)) [compat]... -
クラス/メソッドの定義 (44.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...クラス/メソッドの定義
* クラス/メソッドの定義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* d......式は、最後に評価した式の結果を返します。最後に評価した式
が値を返さない場合は nil を返します。
===[a:singleton_class] 特異クラス定義
//emlist[例][ruby]{
obj = Object.new # obj = nil でも可
class << obj
def test
# ...
end
# ...
end
//......# <- foo は未定義
def foo
print "foo\n"
end
//}
は未定義メソッドの呼び出しで例外 NameError を発生させます。
===[a:singleton_method] 特異メソッド定義
//emlist[例][ruby]{
def foo.test
print "this is foo\n"
end
//}
文法:
def 式 `.' 識別子 [`... -
NEWS for Ruby 2
. 1 . 0 (36.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...した
* Kernel
* 追加: Kernel#singleton_method(Object#singleton_method)
* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラス......* 特異クラスの祖先はそれ自身を含みます。
The ancestors of a singleton class now include singleton classes,
in particular itself.
* Module#define_method Object#define_singleton_method
* 定義したメソッドの名前をシンボルで返すようになり... -
Object
# initialize _ copy(obj) -> object (24.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...obj.tainted?}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end
obj.foo = 1
obj.taint
check Object.new.send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# tainted?: false
# singleton methods: #<NoMethodErro......>
check obj.dup
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# tainted?: true
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# tainted?: true
# singleton methods: :bar
//}......stance variables: #{obj.inspect}"
print "singleton methods: "
begin
p obj.bar
rescue NameError
p $!
end
end
obj.foo = 1
check Object.new.send(:initialize_copy, obj)
#=> instance variables: #<Object:0x4019c9d4>
# singleton methods: #<NoMethodError: ...>
check obj.d......up
#=> instance variables: #<Object:0x4019c9c0 @foo=1>
# singleton methods: #<NoMethodError: ...>
check obj.clone
#=> instance variables: #<Object:0x4019c880 @foo=1>
# singleton methods: :bar
//}... -
rdoc
/ parser / ruby (24.0) -
Ruby のソースコードを解析するためのサブライブラリです。
...解析
されます。特異メソッドとしたい場合は、:singleton-method: 命令を指定しま
す。
##
# :singleton-method:
以下のようにメソッド名を指定する事もできます。
##
# :singleton-method: woo_hoo!
また、属性についても同様に :attr:、......事ができます。属性の名前は省略できます。
##
# :attr_reader: my_attr_name
=== 隠しメソッド、属性
:method:、 :singleton-method: や :attr: 命令を使う事で実際には定義され
ていないメソッドもドキュメントに含める事ができます。... -
Ruby用語集 (18.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...一性
: 特異クラス
: singleton class
すべてのオブジェクトには自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。
参照:Object#singleton_class
: 特異メソッド
: singleton method
オブジェク...