るりまサーチ

最速Rubyリファレンスマニュアル検索!
81件ヒット [1-81件を表示] (0.078秒)
トップページ > クエリ:-[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 (18219.0)

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

...します。

@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 (6219.0)

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

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

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

Ruby用語集 (132.0)

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

...l#percent

: 0 オリジン
: zero-based
番号が 0 から始まること。

例えば、
Array や Vector、Matrix などの要素の番号、
String における文字の位置、
といったものは 0 オリジンである。

: 1 オリジン
: one-based
番号が 1 から始ま...
...ログラミング言語。
型推論を持った静的型付け言語であり、処理系はコンパイラーである。

https://ja.crystal-lang.org/

: CSI 方式
CSI は Code Set Independent の頭字語。
プログラミング言語の処理系が文字列を扱う際のエンコー...
...自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。

参照:Object#singleton_class

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

Module#private_class_method(*name) -> self (112.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 (112.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
//}...

絞り込み条件を変える

クラス/メソッドの定義 (112.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
//}...
...い場合は nil を返します。

===[a:method] メソッド定義

//emlist[例][ruby]{
def fact(n)
if n == 1 then
1
else
n * fact(n-1)
end
end
//}

文法:

def メソッド名 ['(' [arg0 ['=' default0]] ... [',' '*' rest_args [, post ...]] [',' key1: [val1]] ... [',' '*...

NEWS for Ruby 2.1.0 (78.0)

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

...は参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリストは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.0.0 以降の変更

=== 言語仕様の変更

* キーワード引数のデフォルト値...
...: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスであれば true を返します。
レシーバーが通常のクラスやモジュールであれ...
...scrub, String#scrub! 不正なバイト列を検証して修正します。
古いバージョンのRubyと一緒に使いたいときは string-scrub gem を使います。

* Symbol
* 全てのシンボルは freeze されるようになりました

* pack/unpack (Array/String)...

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (78.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

...xxx # => 実行結果

慣用的に実行結果を示すために使われるコメントの書き方。

: #! ruby -Ks

shebang。d:spec/rubycmd#shebangを参照。

: # coding: utf-8

マジックコメント。d:spec/m17n#magic_comment を参照。

: "a is #{a}"

d:spec/literal#exp
//emlist{...
...法の一種。d:spec/literal#percent。ダブルクォート文字列で %Q!STRING! と同じ。
//emlist{
p %!nomad! #=> "nomad"
//}

: % ruby -e "puts 'Hello'"

コマンドラインへの入力を示す。rubyスクリプト上で入力を行うには `command` や system(command) などと...
...クラス定義でスーパークラスを指定しています。
d:spec/def#class。

: class << obj

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

===[a:rangl] >

: 3 > 5

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

: 3 >= 5

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

: 3...