るりまサーチ

最速Rubyリファレンスマニュアル検索!
11823件ヒット [1-100件を表示] (0.130秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:p[x] > クエリ:-[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. dh p
  5. rsa p

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Complex#-(other) -> Complex (21215.0)

差を計算します。

...差を計算します。

@param other 自身から引く数

//emlist[例][ruby]{
Complex(1, 2) - Complex(2, 3) # => (-1-1i)
//}...

Time#-(sec) -> Time (18171.0)

自身より sec 秒だけ前の時刻を返します。

...り sec 秒だけ前の時刻を返します。

@param sec 実数を秒を単位として指定します。

//emlist[][ruby]{
p
t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p
t2 = t + 2592000 # => 2000-01-31 00:00:00 +0900
p
t2 - 2592000 # => 2000-01-01 00:00:00 +0900
//}...

Time#-(time) -> Float (18161.0)

自身と time との時刻の差を Float で返します。単位は秒です。

...します。単位は秒です。

@param time 自身との差を算出したい Time オブジェクトを指定します。

//emlist[][ruby]{
p
t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p
t2 = t + 2592000 # => 2000-01-31 00:00:00 +0900
p
t2 - t # => 2592000.0
//}...

Array#repeated_permutation(n) -> Enumerator (12304.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm...
...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

Array#repeated_permutation(n) { |p| ... } -> self (12304.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。

@raise TypeError 引数に整数以外の(暗黙...
...a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm...
...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

絞り込み条件を変える

Exception#exception(error_message) -> Exception (9303.0)

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。

...数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。

Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。

@param error_message エラーメッセージを表す文字列...
...を指定します。

//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}...

Complex#-@ -> Complex (9221.0)

自身の符号を反転させたものを返します。

...自身の符号を反転させたものを返します。

//emlist[例][ruby]{
-
Complex(1) # => (-1+0i)
-
Complex(-1, 1) # => (1-1i)
//}...

Proc#to_proc -> self (9209.0)

self を返します。

...self を返します。

//emlist[例][ruby]{
p
r = proc {}
p
pr == pr.to_proc # => true
//}...

Exception#exception -> self (9203.0)

引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。

...数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。

Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。

@param error_message エラーメッセージを表す文字列...
...を指定します。

//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}...

Array#pack(template) -> String (6653.0)

配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。

...配列の内容を template で指定された文字列にしたがって、
バイナリとしてパックした文字列を返します。

テンプレートは
型指定文字列とその長さ(省略時は1)を並べたものです。長さと
して * が指定された時は「残りのデ...
...」の長さを
表します。型指定文字は以下で述べる pack テンプレート文字列の通りです。

buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
...
...してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。

//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}

@param template 自身のバイナリとしてパックす...

絞り込み条件を変える

<< 1 2 3 ... > >>