355件ヒット
[1-100件を表示]
(0.035秒)
種類
- インスタンスメソッド (283)
- 文書 (50)
- 特異メソッド (22)
ライブラリ
- ビルトイン (225)
- shell (12)
-
shell
/ command-processor (12) -
shell
/ filter (12) - socket (11)
- zlib (33)
クラス
- BasicSocket (11)
-
Encoding
:: Converter (44) -
Enumerator
:: ArithmeticSequence (6) - File (22)
- IO (11)
- Integer (21)
- MatchData (44)
- Random (33)
- Regexp (11)
- Shell (12)
-
Shell
:: CommandProcessor (12) -
Shell
:: Filter (12) - SignalException (11)
- SystemCallError (11)
- SystemExit (11)
-
Zlib
:: GzipReader (33)
キーワード
-
/ (10) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - =~ (11)
-
NEWS for Ruby 2
. 2 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (7) - Ruby用語集 (11)
- [] (18)
- delete (11)
- div (11)
- end (11)
- errno (11)
- getc (11)
- getpeereid (11)
- hash (6)
- lineno (11)
- offset (22)
-
primitive
_ convert (44) - rand (33)
- readbyte (11)
- readchar (11)
-
ruby 1
. 6 feature (11) - signo (11)
- status (11)
- test (18)
- unlink (11)
検索結果
先頭5件
-
Integer
# div(other) -> Integer (21149.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
...ます。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側......# => 3
begin
2.div(0)
rescue => e
e # => #<ZeroDivisionError: divided by 0>
end
begin
2.div(0.0)
rescue => e
e # => #<ZeroDivisionError: divided by 0>
# Integer#/ と違い、引数が Float でもゼロで割ることはできない
end
//}
@see Integer#fdiv, Integer#/, Integer#modulo... -
Integer
# / (other) -> Numeric (21030.0) -
除算の算術演算子。
...除算の算術演算子。
other が Integer の場合、整商(整数の商)を Integer で返します。
普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
other が Float、Rational、Complex の場合、普通の商を other と
同......側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7 / 2 # => 3
7 / -2 # => -4
7 / 2.0 # => 3.5
7 / Rational(2, 1) # => (7/2)
7 / Complex(2, 0) # => ((7/2)+0i)
begin
2 / 0
rescue => e
e # => #<ZeroDivisionError: divided by 0>
end
//}
@see Integer#div, Integer#fdiv, Numeric#quo... -
MatchData
# begin(n) -> Integer | nil (18238.0) -
n 番目の部分文字列先頭のオフセットを返します。
...範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil
p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}
@see MatchData#end... -
MatchData
# offset(n) -> [Integer , Integer] | [nil , nil] (218.0) -
n 番目の部分文字列のオフセットの配列 [start, end] を返 します。
...]{
[ self.begin(n), self.end(n) ]
//}
と同じです。n番目の部分文字列がマッチしていなければ
[nil, nil] を返します。
@param n 部分文字列を指定する数値
@raise IndexError 範囲外の n を指定した場合に発生します。
@see MatchData#begin, MatchDa... -
MatchData
# offset(name) -> [Integer , Integer] | [nil , nil] (218.0) -
name という名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返 します。
...う名前付きグループに対応する部分文字列のオフセットの配列 [start, end] を返
します。
//emlist[例][ruby]{
[ self.begin(name), self.end(name) ]
//}
と同じです。nameの名前付きグループにマッチした部分文字列がなければ
[nil, nil] を返し......('year') # => [0, 4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#begin, MatchData#end......0, 4]
p $~.offset(:year) # => [0, 4]
p $~.offset('month') # => [5, 6]
p $~.offset(:month) # => [5, 6]
p $~.offset('day') # => [nil, nil]
p $~.offset('century') # => `offset': undefined group name reference: century (IndexError)
//}
@see MatchData#begin, MatchData#end, MatchData#offset... -
BasicSocket
# getpeereid -> [Integer , Integer] (208.0) -
Unix ドメインソケットにおいて接続相手の euid と egid を 返します。
...が Unix ドメインソケットでない場合の返り値は
不定です。
require 'socket'
Socket.unix_server_loop("/tmp/sock") {|s|
begin
euid, egid = s.getpeereid
# Check the connected client is myself or not.
next if euid != Process.uid
# do s... -
Ruby用語集 (144.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...大きな整数オブジェクトが属す
クラスだった。Ruby 2.4 で Fixnum と共に Integer に一本化された。
このとき Bignum は形式的には残されたが単なる Integer のエイリアスとなった。
: blade
Ruby の各種メーリングリストのアーカイ......く実装するための手法の一つ。
例えば新しい数値クラス N を定義し、Integer と N の演算を可能にしたいとする。
Integer と N の加算を行うと、Integer 側では相手が未知のため、自身を引数に
まず相手側の N#coerce を呼ぶ。N......ジェクトの順序関係を表す
演算子 <=> の俗称。
: 埋め込みドキュメント
: embedded document
ソースコード中の =begin 行から =end 行まで。コメントとみなされ実行されない。
その名の通り、この部分にコードのドキュメント... -
Random
# rand(max) -> Integer | Float (138.0) -
一様な擬似乱数を発生させます。
...範囲から除かれます。
range.end - range.begin が整数を返す場合は range.begin + self.rand((range.end - range.begin) + e)
の値を返します(e は終端を含む場合は1、含まない場合は0です)。
range.end - range.begin が実数を返す場合も同様です。
この......ge 発生させる乱数値の範囲を Range オブジェクトで指定します。
range.end - range.begin は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。
@raise Errno::EDOM rand(1..Float::INFINITY) などのよ... -
Random
# rand(range) -> Integer | Float (138.0) -
一様な擬似乱数を発生させます。
...範囲から除かれます。
range.end - range.begin が整数を返す場合は range.begin + self.rand((range.end - range.begin) + e)
の値を返します(e は終端を含む場合は1、含まない場合は0です)。
range.end - range.begin が実数を返す場合も同様です。
この......ge 発生させる乱数値の範囲を Range オブジェクトで指定します。
range.end - range.begin は数値である必要があり、
range.begin + 数値 が適切な値を返す必要があります。
@raise Errno::EDOM rand(1..Float::INFINITY) などのよ... -
SystemCallError
# errno -> Integer | nil (113.0) -
レシーバに対応するシステム依存のエラーコードを返します。
...ドを渡さない形式で生成した場合は nil を返します。
begin
raise Errno::ENOENT
rescue Errno::ENOENT => err
p err.errno # => 2
p Errno::ENOENT::Errno # => 2
end
begin
raise SystemCallError, 'message'
rescue SystemCallError => err...