るりまサーチ

最速Rubyリファレンスマニュアル検索!
2934件ヒット [1-100件を表示] (0.229秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:n[x] > クエリ:%[x]

別のキーワード

  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 (24664.0)

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

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

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

@param args フォーマットする値、もしくはその配列
@return...
...//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] # =>...
...しています。

%
[nth$][フラグ][幅][.精度]指示子
%
[<name>][フラグ][幅][.精度]指示子

`%' 自身を出力するには `%%' とします。

以下それぞれの要素に関して説明します。

=== フラグ

フラグには #, +, ' '(スペース), -, 0 の5種類があ...

Numeric#%(other) -> Numeric (24464.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 と同じ符号になります...
...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 (24460.0)

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

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

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

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

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

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

...

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

//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}...

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

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

...

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

//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}...

絞り込み条件を変える

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

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

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

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

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

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

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

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

OpenSSL::BN#%(other) -> OpenSSL::BN (21400.0)

自身を other で割り算した余りを返します。

...自身を other で割り算した余りを返します。

@param other 除数
@raise OpenSSL::BNError 計算時エラー...

Benchmark.#benchmark(caption = "", label_width = nil, fmtstr = nil, *labels) {|rep| ...} -> [Benchmark::Tms] (18590.0)

Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。

...Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。

基本的には以下のように使います。
ブロックが Benchmark::Tms オブジェクトの配列を返した場合は、
それらの数値も追加の行に表示...
...す。

@param caption レポートの一行目に表示する文字列を指定します。
@param label_width ラベルの幅を指定します。
@param fmtstr フォーマット文字列を指定します。
この引数を省略すると Benchmark::FORMAT が使用...
...
@param labels ブロックが Benchmark::Tms オブジェクトの配列を返す場合に指定します。

=== フォーマット文字列

フォーマット文字列として以下が使用できます。

: %u
user CPU time で置き換えられます。Benchmark::Tms#utime
: %y
syste...

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) -> Enumerator (15412.0)

node から到達可能な強連結成分についてのイテレータです。

...
n
ode から到達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from は
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示...
..._node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end

n
on_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

n
on_sort.each_strongly_connected_component{|nodes|
p nodes
n
odes.each {|node|
n
on_sort.each_strongly_connected_component_from(node){|ns|
printf("%s...
...-> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

絞り込み条件を変える

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) {|nodes| ...} -> () (15412.0)

node から到達可能な強連結成分についてのイテレータです。

...
n
ode から到達可能な強連結成分についてのイテレータです。

返す値は規定されていません。

each_strongly_connected_component_from は
tsort_each_node を呼びません。

@param node ノードを指定します。

//emlist[例 到達可能なノードを表示...
..._node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end

n
on_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

n
on_sort.each_strongly_connected_component{|nodes|
p nodes
n
odes.each {|node|
n
on_sort.each_strongly_connected_component_from(node){|ns|
printf("%s...
...-> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,3
#=> 1 -> 1
//}

@see TSort.each_strongly_connected_component_from...

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

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

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

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_by...
...Encoding::Converter::AFTER_OUTPUT

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

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

//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8...
...nvert(src, dst)
p [ret, src, dst, ec.primitive_errinfo]
case ret
when :invalid_byte_sequence
ec.insert_output(ec.primitive_errinfo[3].dump[1..-2])
r
edo
when :undefined_conversion
c = ec.primitive_errinfo[3].dup.force_encoding(ec.primitive_errinfo[1])
ec.insert_output('\x{%X:%...
<< 1 2 3 ... > >>