種類
- 文書 (24)
- インスタンスメソッド (12)
ライブラリ
- ビルトイン (12)
クラス
- Object (12)
キーワード
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- クラス/メソッドの定義 (12)
検索結果
-
Object
# singleton _ class -> Class (27243.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... -
クラス/メソッドの定義 (88.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......erclass ]
式..
end
文法:
class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]
end
クラスを定義します......の結果を返します。最後に評価した式
が値を返さない場合は nil を返します。
===[a:singleton_class] 特異クラス定義
//emlist[例][ruby]{
obj = Object.new # obj = nil でも可
class << obj
def test
# ...
end
# ...
end
//}
文法:
class `<<'... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (72.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:num] #
: #コメント
d:spec/lexical#comment。# から行末までがコメントになります。
: xxx #=> 実行結果
: xxx # => 実行結果
慣用的に実行結果を示すために使われるコメントの書き方。
: #! ruby -Ks
shebang。d:spec/rubycmd......。d:spec/variables#const を参照。
: ::DateTime
定数のスコープ演算子で、トップレベルの定数であることを示す。Object クラスで
定義されている定数(トップレベルの定数と言う)を確実に参照するためには
d:spec/variables#const を参......pec/def#class。
: class << obj
特異クラス定義。d:spec/def#singleton_classを参照。
===[a:rangl] >
: 3 > 5
「より大きい」比較演算子
: 3 >= 5
「より大きいか等しい」比較演算子
: 3 <=> 3
基本的な比較演算子。ほかの比較演算子はこの...