ライブラリ
- ビルトイン (204)
- bigdecimal (24)
検索結果
先頭5件
-
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (18504.0) -
引数を整数 (Fixnum,Bignum) に変換した結果を返します。
...プリフィクスは、0b
(2 進数)、0 (8 進数)、0o (8 進数)、0d (10 進数)、0x (16 進
数) です。
@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise A......数(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... -
Kernel
. # Integer(arg , base = 0) -> Integer (18404.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 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 String#hex,String#oct,String#to_... -
Kernel
. # BigDecimal(s) -> BigDecimal (6250.0) -
引数で指定した値を表す BigDecimal オブジェクトを生成します。
...引数で指定した値を表す BigDecimal オブジェクトを生成します。
@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無......うな割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算における最大... -
Kernel
. # BigDecimal(s , exception: true) -> BigDecimal | nil (6250.0) -
引数で指定した値を表す BigDecimal オブジェクトを生成します。
...引数で指定した値を表す BigDecimal オブジェクトを生成します。
@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無......うな割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算における最大......有効桁数 n の取り扱いは将来のバー
ジョンで若干変更される可能性があります。
@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError s に... -
Kernel
. # BigDecimal(s , n) -> BigDecimal (6250.0) -
引数で指定した値を表す BigDecimal オブジェクトを生成します。
...引数で指定した値を表す BigDecimal オブジェクトを生成します。
@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無......うな割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算における最大... -
Kernel
. # BigDecimal(s , n , exception: true) -> BigDecimal | nil (6250.0) -
引数で指定した値を表す BigDecimal オブジェクトを生成します。
...引数で指定した値を表す BigDecimal オブジェクトを生成します。
@param s 数値を表現する初期値を文字列、Integer、
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無......うな割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算における最大......有効桁数 n の取り扱いは将来のバー
ジョンで若干変更される可能性があります。
@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError s に... -
Kernel
. # syscall(num , *arg) -> Integer (6209.0) -
numで指定された番号のシステムコールを実行します。 第2引数以降をシステムコールの引数として渡します。
...て渡します。
どの数値がどのシステムコールに対応するかは、
syscall(2) や
/usr/include/sys/syscall.h を参照してください。
システムコールの慣習に従い、syscall(2)
が -1 を返す場合には例外 Errno::EXXX が発生します。
それ以外で......yscall(2) が -1 を返した場合に発生します。
@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。
//emlist[例][ruby]{
syscall 4, 1, "hello\n", 6 # '4' is write(2) on our box
# => hello
//}
@see fiddle, syscall(2freebsd), syscal... -
Kernel
. # putc(ch) -> object (6132.0) -
文字 ch を 標準出力 $stdout に出力します。
...文字 ch を 標準出力 $stdout に出力します。
ch が数値なら 0 〜 255 の範囲の対応する文字を出力します。
ch が文字列なら、その先頭1文字を出力します。
どちらでもない場合は、ch.to_int で整数に変換を試みます。
@param ch 出......@return ch を返します
@raise RangeError Bignum を引数にした場合に発生します。
@raise IOError 標準出力が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
@raise TypeError Integer に変......きないオブジェクトを引数に
指定した場合に発生します。
//emlist[例][ruby]{
putc("ch")
putc(?c)
putc(99)
putc(355)
#=> cccc
putc(99.00) #=> c
putc(33333333333333333333333333333333333) # bignum too big to convert into `long' (RangeError)
//}
@see IO#putc... -
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (221.0) -
単体のファイルでファイルテストを行います。
...単体のファイルでファイルテストを行います。
@param cmd 以下に示す文字リテラル、文字列、あるいは同じ文字を表す数値
です。文字列の場合はその先頭の文字だけをコマンドとみなします。
@param file テストするフ......字列か IO オブジェクトを指定します。
@return 下表に特に明記していないものは、真偽値を返します。
以下は cmd として指定できる文字リテラルとその意味です。
: ?r
ファイルを実効 uid で読むことができる
: ?w
ファ......: ?z
ファイルサイズが 0 である
: ?s
ファイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシン... -
Kernel
. # spawn(command , options={}) -> Integer (208.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...= 引数の解釈
この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。
@param command コマンドを文字列で指......表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
. # spawn(env , command , options={}) -> Integer (208.0) -
引数を外部コマンドとして実行しますが、生成した 子プロセスの終了を待ち合わせません。生成した子プロセスのプロセスIDを返します。
...= 引数の解釈
この形式では command が shell のメタ文字
//emlist{
* ? {} [] <> () ~ & | \ $ ; ' ` " \n
//}
を含む場合、shell 経由で実行されます。
そうでなければインタプリタから直接実行されます。
@param command コマンドを文字列で指......表す Hash
@param options オプションパラメータ Hash
@raise Errno::EXXX 起動に失敗し、ruby インタプリタに制御が戻った場合に発生します。
@raise Errno::EXXX コマンドが実行できなかった場合に発生します。
@see Kernel.#system,Kernel.#exec... -
Kernel
. # sleep(sec) -> Integer (204.0) -
sec 秒だけプログラムの実行を停止します。
...sec 秒だけプログラムの実行を停止します。
sec が省略された場合、他スレッドからの Thread#run
などで明示的に起こさない限り永久にスリープします。Thread#runを呼ぶとその時点で
sleepの実行が中断されます。
@param sec 停止...