るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.021秒)
トップページ > クエリ:FALSE[x] > クエリ:singleton_class[x]

別のキーワード

  1. singleton clone
  2. singleton dup
  3. singleton instance
  4. object define_singleton_method
  5. _builtin define_singleton_method

検索結果

Object#singleton_class -> Class (18125.0)

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

...l か true か false なら、それぞれ NilClass, TrueClass,
False
Class を返します。

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

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

@see Object#class...

Module#singleton_class? -> bool (6141.0)

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

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

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

Ruby用語集 (36.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...ate method
返り値を真偽値として用いるためのメソッド。
メソッド名の末尾に ? を付ける習慣がある。

true/false を返すとは限らず、真である場合に、true 以外のオブジェクトを
返すことで、単なる真偽を越えた情報を与...
...表として、いくつかある。

: 真偽値
: Boolean value
Ruby ではどんなオブジェクトも真または偽である。
nil と false だけが偽であり、空文字列、空配列も含め、他のすべての
オブジェクトは真である。

Ruby では、値の型・...
...自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。

参照:Object#singleton_class

: 特異メソッド
: singleton method
オブジェクト固有のメソッド。
オブジェクトの特異クラスのインスタ...

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (30.0)

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or  plus minus ast slash hat sq  period comma langl rangl eq tilde  dollar at under lbrarbra  lbra2rbra2 lbra3rbra3 dq colon ac  backslash semicolon

...ド。

: a ^= true

「^」演算子の自己代入演算子。aの論理値の反転。
//emlist{
p(a=true);p(a^=true);p(a^=true) #=> true false true
//}

: /^xxx/

正規表現で、行頭。文字列の先頭や改行文字の直後の位置にマッチします。

===[a:colon] :

: :exit...
...212345'.each_char { |n| print( (n == ?2)..(n == ?4) ? n : '_' ) } #=> _234___21234_
#"2"が出るまではfalse、"2"が出てから"4"が出るまではtrue、"4"から"2"まではfalseを返す。
//}

: /xx.xx/

正規表現の任意の一文字。


===[a:comma] ,

: a,b, = [1,2,3] ・・...
...クラス定義でスーパークラスを指定しています。
d:spec/def#class。

: class << obj

特異クラス定義。d:spec/def#singleton_classを参照。

===[a:rangl] >

: 3 > 5

「より大きい」比較演算子

: 3 >= 5

「より大きいか等しい」比較演算子

: 3...
...212345'.each_char { |n| print( (n == ?2)..(n == ?4) ? n : '_' ) } #=> _234___21234_
#"2"が出るまではfalse、"2"が出てから"4"が出るまではtrue、"4"から"2"まではfalseを返す。
//}

: /xx.xx/

正規表現の任意の一文字。

: def foo(...)

受け取った引数を...

クラス/メソッドの定義 (28.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
//}...
...ってしまいます。

以下は、defined? が返す値の一覧です。

* "super"
* "method"
* "yield"
* "self"
* "nil"
* "true"
* "false"
* "assignment"
* "local-variable"
* "local-variable(in-block)"
* "global-variable"
* "instance-variable"
* "constant"
* "class variable"
*...

絞り込み条件を変える

NEWS for Ruby 2.1.0 (24.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...d_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるようになりました
* 拡張: IO#write_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるようになりました

* Kernel
* 追加: Ker...
...in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスであれば true を返します。
レシーバーが通常のクラスやモジュールであれば false を返します。
* 拡張: Module#refine はもはや実験...

Module#private_class_method(*name) -> self (18.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。

...@param name 0 個以上の String または Symbol を指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...
...mes 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...

Module#private_class_method(names) -> self (18.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。

...mes 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...