758件ヒット
[1-100件を表示]
(0.235秒)
ライブラリ
- ビルトイン (758)
キーワード
- % (11)
- & (11)
- * (11)
- ** (11)
- + (11)
- - (11)
- -@ (11)
-
/ (10) - < (11)
- << (11)
- <= (11)
- <=> (11)
- == (11)
- === (11)
- >= (11)
- >> (11)
- [] (21)
- ^ (11)
- abs (11)
- allbits? (7)
- anybits? (7)
-
bit
_ length (11) - ceil (11)
- ceildiv (2)
- chr (22)
- denominator (11)
- digits (22)
- div (11)
- divmod (11)
- downto (22)
- even? (11)
- fdiv (11)
- floor (11)
- gcd (11)
- gcdlcm (11)
- inspect (11)
- integer? (11)
- lcm (11)
- magnitude (11)
- modulo (11)
- next (11)
- nobits? (7)
- numerator (11)
- odd? (11)
- ord (11)
- pow (22)
- pred (11)
- rationalize (22)
- remainder (11)
- round (11)
- size (11)
- succ (11)
- times (22)
-
to
_ f (11) -
to
_ i (11) -
to
_ int (11) -
to
_ r (11) -
to
_ s (11) - truncate (11)
- upto (22)
- | (11)
- ~ (11)
検索結果
先頭5件
-
Integer
# >(other) -> bool (26114.0) -
比較演算子。数値として大きいか判定します。
...演算子。数値として大きいか判定します。
@param other 比較対象の数値
@return self よりも other の方が小さい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 > 0 # => true
1 > 1 # => false
//}... -
Integer
# <=>(other) -> -1 | 0 | 1 | nil (14102.0) -
self と other を比較して、self が大きい時に1、等しい時に 0、小さい時 に-1、比較できない時に nil を返します。
...、self が大きい時に1、等しい時に 0、小さい時
に-1、比較できない時に nil を返します。
@param other 比較対象の数値
@return -1 か 0 か 1 か nil のいずれか
//emlist[][ruby]{
1 <=> 2 # => -1
1 <=> 1 # => 0
2 <=> 1 # => 1
2 <=> '' # => nil
//}... -
Integer
# >=(other) -> bool (14102.0) -
比較演算子。数値として等しいまたは大きいか判定します。
...other 比較対象の数値
@return self よりも other の方が小さい場合か、
両者が等しい場合 true を返します。
そうでなければ false を返します。
//emlist[][ruby]{
1 >= 0 # => true
1 >= 1 # => true
1 >= 2 # => false
//}... -
Integer
# >>(bits) -> Integer (14102.0) -
シフト演算子。bits だけビットを右にシフトします。
...、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
//emlist[][ruby]{
printf("%#b\n", 0b0101 >> 1) # => 0b10
p -1 >> 1 # => -1
//}... -
Integer
# upto(max) -> Enumerator (8118.0) -
self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。
...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。
@param max 数値
@return self を返します。
//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}
@see Integer#downto, Numeric#step, Integer#times... -
Integer
# upto(max) {|n| . . . } -> Integer (8118.0) -
self から max まで 1 ずつ増やしながら繰り返します。 self > max であれば何もしません。
...self から max まで 1 ずつ増やしながら繰り返します。
self > max であれば何もしません。
@param max 数値
@return self を返します。
//emlist[][ruby]{
5.upto(10) {|i| print i, " " } # => 5 6 7 8 9 10
//}
@see Integer#downto, Numeric#step, Integer#times... -
Integer
# chr -> String (8114.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ncoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無しで呼ばれ......ト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' など。... -
Integer
# chr(encoding) -> String (8114.0) -
self を文字コードとして見た時に、引数で与えたエンコーディング encoding に対応する文字を返します。
...ncoding に対応する文字を返します。
//emlist[][ruby]{
p 65.chr
# => "A"
p 12354.chr
# => `chr': 12354 out of char range (RangeError)
p 12354.chr(Encoding::UTF_8)
# => "あ"
p 12354.chr(Encoding::EUC_JP)
# => RangeError: invalid codepoint 0x3042 in EUC-JP
//}
引数無しで呼ばれ......ト内部エンコーディングの順で優先的に解釈します。
//emlist[][ruby]{
p 0x79.chr.encoding # => #<Encoding:US_ASCII>
p 0x80.chr.encoding # => #<Encoding:ASCII_8BIT>
//}
@param encoding エンコーディングを表すオブジェクト。Encoding::UTF_8、'shift_jis' など。... -
Integer
# div(other) -> Integer (8114.0) -
整商(整数の商)を返します。 普通の商(剰余を考えない商)を越えない最大の整数をもって整商とします。
...ther が Integer オブジェクトの場合、Integer#/ の結果と一致します。
div に対応する剰余メソッドは modulo です。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[例][ruby]{
7.div(2) # => 3
7.div(-2) # => -4
7.div(2.0) # => 3
7.div......)) # => 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#modu... -
Integer
# / (other) -> Numeric (8108.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...