るりまサーチ

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

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

...します。

@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...

クラス/メソッドの定義 (46.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
//}...
...e, else, ensure 節を指定できます。
例外処理についてはd:spec/control#begin参照。

メソッド定義式は、メソッド名を Symbol にしたオブジェクトを返します。

@see https://magazine.rubyist.net/articles/0041/0041-200Special-kwarg.html

====[a:operator] 演...

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

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

... Symbol を指定します。
@param names 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.priv...

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

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

... Symbol を指定します。
@param names 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.priv...

Ruby用語集 (24.0)

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

...ンタックスシュガーとして
用意されている。

構文糖衣、構文糖、糖衣構文とも呼ばれる。

: シンボル
: symbol
文字列と一対一に対応する、Ruby の処理系内部で整数により管理されるオブジェクト。

イミュータブルで...
...前を整数で管理しているが、この整数がまさにシンボルのもつ整数値である。

参照:Symbol

: シンボル配列
要素がシンボル(Symbol オブジェクト)だけからなる配列。
配列式としては % 記法で書くこともできる。

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

参照:Object#singleton_class

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

絞り込み条件を変える

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
//}...

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

: :exit等の:のついた識別子

シンボルリテラル。d:spec/literal#symbol を参照。

: Net::HTTP

定数のスコープ演算子。d:spec/variables#const を参照。

: ::DateTime

定数のスコープ演算子で...
...クラス定義でスーパークラスを指定しています。
d:spec/def#class。

: class << obj

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

===[a:rangl] >

: 3 > 5

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

: 3 >= 5

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

: 3...
...。d:spec/variables#classを参照。

: def +@ または def -@

単項演算子 +X や -X を定義するときの表記法。
//emlist{
class Symbol
def +@
self.upcase
end
end

puts(+:joke) #=> JOKE
//}

===[a:under] _

: xxx_yyy

識別子の中では小文字と同じ扱...

NEWS for Ruby 2.1.0 (12.0)

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

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

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

* pack/unpack (Array/String)
* プラットフォームが対応し...