るりまサーチ

最速Rubyリファレンスマニュアル検索!
1686件ヒット [1-100件を表示] (0.088秒)

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

String#%(args) -> String (21347.0)

printf と同じ規則に従って args をフォーマットします。

...printf と同じ規則に従って args をフォーマットします。

args が配列であれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。

@param args フォーマットする値、もしくはその配列
@retur...
...//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10 # => "i = 12"

p "i = %#d" % 10 # => "i = 10"
p "i = %#x" % 10 # => "i = 0xa"
p "i = %#o" % 10 # => "i = 012"

p "%d" % 10 # => "10"
p "%d,%o" % [10, 10] # =>...
...2"
//}

=== sprintf フォーマット

R
uby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が存在すること、sprintf のすべ...

Numeric#%(other) -> Numeric (21255.0)

self を other で割った余り r を返します。

...self を other で割った余り r を返します。

ここで、商 q と余り r は、

* self == other * q + r

* other > 0 のとき 0 <= r < other
* other < 0 のとき other < r <= 0
* q は整数

をみたす数です。
余り r は、other と同じ符号になります...
...
商 q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。

@param other 自身を割る数を指定します。

//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4...
...) #=> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}

@see Numeric#divmod, Numeric#remainder...

Integer#%(other) -> Numeric (21227.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Range#%(s) -> Enumerator (21203.0)

範囲内の要素を s おきに繰り返します。

...ます。

@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequenc...
...e を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {...
...@param s 次のステップへ遷移するたびに加算されるものを指定します。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

Range#%(s) -> Enumerator::ArithmeticSequence (21203.0)

範囲内の要素を s おきに繰り返します。

...ます。

@param s 各ステップの大きさを数値で指定します。負の数を指定することもできます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequenc...
...e を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {...
...@param s 次のステップへ遷移するたびに加算されるものを指定します。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

絞り込み条件を変える

Float#%(other) -> Float (18215.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 剰余
3.0 % 1.2 # => 0.6000000000000001
3.0 % 0.0 # ZeroDivisionError
//}...

Bignum#%(other) -> Fixnum | Bignum | Float (18203.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Fixnum#%(other) -> Fixnum | Bignum | Float (18203.0)

算術演算子。剰余を計算します。

...算術演算子。剰余を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (9109.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by...
...aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after...
...t before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (9109.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by...
...aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after...
...t before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (9109.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

...、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by...
...aram options 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol

options には以下が指定できます。

: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after...
...t before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT

戻り値は以下のうちのどれかです。

* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty...
<< 1 2 3 ... > >>