種類
- 文書 (44)
- インスタンスメソッド (37)
ライブラリ
- ビルトイン (37)
キーワード
-
NEWS for Ruby 2
. 1 . 0 (11) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Ruby用語集 (11)
-
private
_ class _ method (15) -
singleton
_ class? (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Object
# singleton _ class -> Class (18231.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...l か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。
@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 (6247.0) -
self が特異クラスの場合に true を返します。そうでなければ false を返し ます。
...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。
//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}... -
Ruby用語集 (4011.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...Ruby用語集
A B C D E F G I J M N O R S Y
a ka sa ta na ha ma ya ra wa
=== 記号・数字
: %記法
: % notation
「%」記号で始まる多種多様なリテラル記法の総称。
参照:d:spec/literal#percent
: 0 オリジン
: zero-ba......ate method
返り値を真偽値として用いるためのメソッド。
メソッド名の末尾に ? を付ける習慣がある。
true/false を返すとは限らず、真である場合に、true 以外のオブジェクトを
返すことで、単なる真偽を越えた情報を与......自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。
参照:Object#singleton_class
: 特異メソッド
: singleton method
オブジェクト固有のメソッド。
オブジェクトの特異クラスのインスタ... -
NEWS for Ruby 2
. 1 . 0 (3267.0) -
NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.1.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......トは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.0.0 以降の変更
=== 言語仕様の変更
* キーワード引数のデフォルト値が省略可能になりました。これらの「必須キーワード引数」は呼び出し時に明......d_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるようになりました
* 拡張: IO#write_nonblock シンボルを返すためにキーワード引数 `exception: false` を受け付けるようになりました
* Kernel
* 追加: Ker... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (3177.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
...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 semicol......#! ruby -Ks
shebang。d:spec/rubycmd#shebangを参照。
: # coding: utf-8
マジックコメント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{
a = 10
p "a is #{a}" #=> "a is 10"
//}
: Range#each
説明文の中でのみ使われます。Ruby......ド。
: a ^= true
「^」演算子の自己代入演算子。aの論理値の反転。
//emlist{
p(a=true);p(a^=true);p(a^=true) #=> true false true
//}
: /^xxx/
正規表現で、行頭。文字列の先頭や改行文字の直後の位置にマッチします。
===[a:colon] :
: :exit... -
クラス/メソッドの定義 (382.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
* defined
===[a:class] クラス定義
//emlist[例][ruby]{
class Foo < Su......価した式
が値を返さない場合は 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 ...]]......ます。
以下は、defined? が返す値の一覧です。
* "super"
* "method"
* "yield"
* "self"
* "nil"
* "true"
* "false"
* "assignment"
* "local-variable"
* "local-variable(in-block)"
* "global-variable"
* "instance-variable"
* "constant"
* "class variable"
* "expression"... -
Module
# private _ class _ method(*name) -> self (124.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 (124.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
//}...