別のキーワード
種類
- インスタンスメソッド (167)
- 文書 (141)
- モジュール関数 (44)
- 特異メソッド (36)
- クラス (11)
ライブラリ
クラス
-
ARGF
. class (11) - Array (8)
-
DRb
:: DRbObject (11) - Integer (25)
- Matrix (22)
- Module (16)
- Object (22)
- UNIXSocket (11)
-
WIN32OLE
_ METHOD (33) -
WIN32OLE
_ TYPE (11) -
WIN32OLE
_ TYPELIB (11)
モジュール
- Kernel (44)
- ObjectSpace (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - <=> (11)
- Context (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (8) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Rational (11)
- Ruby用語集 (11)
-
_ _ drbref (11) -
allocation
_ sourceline (11) -
cofactor
_ expansion (11) -
const
_ source _ location (5) -
convertible
_ int (22) - dig (8)
-
each
_ prime (22) - getbyte (11)
- hash (11)
- helpcontext (22)
-
laplace
_ expansion (11) -
memsize
_ of _ all (11) - new (11)
-
recv
_ io (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) -
singleton
_ class (11) -
size
_ opt _ params (11) -
size
_ params (11) -
try
_ convert (3) - このマニュアルのヘルプ (11)
- セキュリティモデル (8)
検索結果
先頭5件
-
Integer
. try _ convert(obj) -> Integer | nil (21288.0) -
obj を Integer に変換しようと試みます。変換には Object#to_int メソッドが使われます。
...obj を Integer に変換しようと試みます。変換には Object#to_int
メソッドが使われます。
Integer ならそのままobjを返します。
そうでなければ obj.to_int の結果を返すか、nil が返されます。
@param obj 変換する任意のオブジェクト......@return Integer または nil
@raise TypeError to_int が Integer を返さなかった場合に発生します。
//emlist[例][ruby]{
Integer.try_convert(1) # => 1
Integer.try_convert(1.25) # => 1
Integer.try_convert([]) # => nil
//}... -
Integer
. each _ prime(upper _ bound) {|prime| . . . } -> object (21107.0) -
全ての素数を列挙し、それぞれの素数をブロックに渡して評価します。
...素数をブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@return ブロックの最後に評価された値を返します。... -
Integer
. each _ prime(upper _ bound) -> Enumerator (21007.0) -
全ての素数を列挙し、それぞれの素数をブロックに渡して評価します。
...素数をブロックに渡して評価します。
@param upper_bound 任意の正の整数を指定します。列挙の上界です。
nil が与えられた場合は無限に列挙し続けます。
@return ブロックの最後に評価された値を返します。... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (18495.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...る代わりに nil を返します。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラ......引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeEr......#=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p Integer(" \n10\t ") #=> 10 # 先頭と末尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid... -
Kernel
. # Integer(arg , base = 0) -> Integer (18388.0) -
引数を整数(Fixnum,Bignum)に変換した結果を返します。
...Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil......into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)
p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p I......尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}
@see Strin... -
Object
# hash -> Integer (9147.0) -
オブジェクトのハッシュ値を返します。このハッシュ値は、Object#eql? と合わせて Hash クラスで、2つのオブジェクトを同一のキーとするか判定するために用いられます。
...オブジェクトのハッシュ値を返します。このハッシュ値は、Object#eql? と合わせて Hash クラスで、2つのオブジェクトを同一のキーとするか判定するために用いられます。
2つのオブジェクトのハッシュ値が異なるとき、直ち......、
A.eql?(B) ならば A.hash == B.hash
の関係が満たされている必要があります。
ただし、ハッシュのキーとして Integer, Symbol, String などの特定の組み込みクラスが使われるときは、組込みのハッシュ関数が使用され、hash メソッ......6494
p 0.hash #=> 2647535320520409998
p 0.0.hash #=> -2975129765814025835
p nil.hash #=> 2401531420355998067
p "ruby".hash #=> 4460896024486900438
p "ruby".hash #=> 4460896024486900438
p :ruby.hash #=> 3979895509189707770
p :ruby.hash #=> 3979895509189707770
//}
@see Object#eql?, Hash#[]... -
Object
# singleton _ class -> Class (9036.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...す。
レシーバが nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.si......ngleton_class #=> #<Class:String>
nil.singleton_class #=> NilClass
//}
@see Object#class... -
ObjectSpace
. # allocation _ sourceline(object) -> Integer (3272.0) -
objectの元となったソースファイルの行番号を返します。
...
objectの元となったソースファイルの行番号を返します。
@param object 元となるソースファイルの行番号を取得したいobjectを指定します。
@return objectの元となるソースファイルの行番号を返します。存在しない場合はnilを返し......y]{
require 'objspace'
ObjectSpace::trace_object_allocations_start
obj = Object.new
puts "line:#{ObjectSpace::allocation_sourceline(obj)}" # => line:4
ObjectSpace::trace_object_allocations_stop
//}
@see ObjectSpace.#trace_object_allocations_start,
ObjectSpace.#trace_object_allocations_stop... -
DRb
:: DRbObject # _ _ drbref -> Integer|nil (3208.0) -
リモートオブジェクトの識別子を返します。
...リモートオブジェクトの識別子を返します。
DRb::DRbObject.new_with_uri で取り出したフロントオブジェクトは
識別子を持たないため nil を返します。... -
ObjectSpace
. # memsize _ of _ all(klass = nil) -> Integer (3208.0) -
すべての生存しているオブジェクトが消費しているメモリ使用量をバイト単位 で返します。
...下のような Ruby のコードで定義できます。
//emlist[例][ruby]{
def memsize_of_all klass = false
total = 0
ObjectSpace.each_object{|e|
total += ObjectSpace.memsize_of(e) if klass == false || e.kind_of?(klass)
}
total
end
//}
戻り値の内容は完全ではない事に... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (828.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)
追加された -W オプションは $VERBOSE = nil の指定(-W0)を......スは特異クラス自身であると定義されました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;
class << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i5......リテラルの prefix として 0d が追加されました。
8進リテラルの prefix として 0 以外に 0o が追加されました。
Integer(), String#to_i、String#oct もこの prefix を認識します。
: ((<メソッド引数の & 修飾|メソッド呼び出し/イテレー...