るりまサーチ

最速Rubyリファレンスマニュアル検索!
939件ヒット [1-100件を表示] (0.042秒)
トップページ > クエリ:Integer[x] > クエリ:on[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer new

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Integer.try_convert(obj) -> Integer | nil (27255.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#rationalize -> Rational (27202.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@param eps 許容する誤差

引数 eps は常に無視されます。

//emlist[][ruby]{
2.rationalize # => (2/1)
2.rationalize(100) # => (2/1)
2.rationalize(0.1) # => (2/1)
//}...

Integer#rationalize(eps) -> Rational (27202.0)

自身を Rational に変換します。

...自身を Rational に変換します。

@param eps 許容する誤差

引数 eps は常に無視されます。

//emlist[][ruby]{
2.rationalize # => (2/1)
2.rationalize(100) # => (2/1)
2.rationalize(0.1) # => (2/1)
//}...

Integer#to_r -> Rational (21102.0)

自身を Rational に変換します。

...自身を Rational に変換します。

//emlist[][ruby]{
1.to_r # => (1/1)
(1<<64).to_r # => (18446744073709551616/1)
//}...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (18460.0)

引数を整数(Fixnum,Bignum)に変換した結果を返します。

...フィクスは、0b
(2 進数)、0 (8 進数)、0o (8 進数)、0d (10 進数)、0x (16 進
数) です。

@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。

@raise Argumen...
...数(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...

絞り込み条件を変える

Module#const_source_location(name, inherited = true) -> [String, Integer] (12303.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...B.const_source_location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない

p A.const_...
...source_location('C2') # => ["test.rb", 16] -- 最後に定義された位置を返す

p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定...
...を返す

p B.const_source_location('A') # => ["test.rb", 1] -- Object を継承している為
p M.const_source_location('A') # => ["test.rb", 1] -- Object は継承していないが追加で modules をチェックする

p Object.const_source_location('A::C1') # => ["t...

Process::CLOCK_MONOTONIC -> Integer | Symbol (12303.0)

Process.#clock_gettime で使われます。

...Process.#clock_gettime で使われます。

システムによっては :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC です。
システムによっては定義されていません。...

Process::CLOCK_MONOTONIC_COARSE -> Integer (12303.0)

Process.#clock_gettime で使われます。

Process.#clock_gettime で使われます。

システムによっては定義されていません。

Process::CLOCK_MONOTONIC_FAST -> Integer (12303.0)

Process.#clock_gettime で使われます。

Process.#clock_gettime で使われます。

システムによっては定義されていません。

Process::CLOCK_MONOTONIC_PRECISE -> Integer (12303.0)

Process.#clock_gettime で使われます。

Process.#clock_gettime で使われます。

システムによっては定義されていません。

絞り込み条件を変える

Process::CLOCK_MONOTONIC_RAW -> Integer (12303.0)

Process.#clock_gettime で使われます。

Process.#clock_gettime で使われます。

システムによっては定義されていません。
<< 1 2 3 ... > >>