るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.036秒)
トップページ > クエリ:to_i[x] > 種類:クラス[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

キーワード

検索結果

Process::Status (13.0)

プロセスの終了ステータスを表すクラスです。 メソッド Process.#wait2 などの返り値として使われます。

...by signal #{$?.stopsig}"
when $?.exited?
p "child #{$?.pid} exited normally. status=#{$?.exitstatus}"
else
p "unknown status %#x" % $?.to_i
end

SIGCHLD を trap する例

trap(:SIGCHLD) {|sig|

puts "interrupted by signal #{sig} at #{caller[1]}"
# 複数の子プロセス...
...g}"
when $?.exited?
puts " child #{$?.pid} exited normally. status=#{$?.exitstatus}"
else
p "unknown status %#x" % $?.to_i
end
end
}

p pid1 = fork { sleep 1; exit }
p pid2 = fork { loop { sleep } } # signal を待つための sleep
begin
Process....

BasicObject (7.0)

特殊な用途のために意図的にほとんど何も定義されていないクラスです。 Objectクラスの親にあたります。Ruby 1.9 以降で導入されました。

...合にだけ BasicObject から派生してください。

=== 例

//emlist[例][ruby]{
class
Proxy < BasicObject
def initialize(target)
@target = target
end

def method_missing(message, *args)
@target.__send__(message, *args)
end
end

proxy = Proxy.new("1")
proxy.to_i #=> 1
//}...

Numeric (7.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...to_f | - - o o o o o
to_i
| - o - - o o o
to_i
nt | o o - - o - -...
...d
//}

また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。

//emlist[][ruby]{
class
Numeric
def roundup(d=0)
x = 10**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end

def roun...
...tional Complex
--------------------------------------------------------------------------------
to_i
| - o o o o
to_i
nt | o o o - -
to_r | - o...