るりまサーチ

最速Rubyリファレンスマニュアル検索!
368件ヒット [1-100件を表示] (0.039秒)
トップページ > クエリ:-[x] > クエリ:rm[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

Kernel.#format(format, *arg) -> String (6422.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...format 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf...
...するには `%%' とします。

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

=== フラグ

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

: #

2進、8進、16進の指示子(b, B, o, x, X) ではそれぞれプレフィック
スとして "0b", "0B",...
...ては、負数に対して "-"
を付加することを示します。

//emlist[][ruby]{
p sprintf("%d", 1) #=> "1"
p sprintf("%+d", 1) #=> "+1"

p sprintf("%x", -1) #=> "..f" # ".." は無限に f が続くことを表している
p sprintf("%+x", -1) #=> "-1"
//}

: ' '(スペース)

`+'...

String#unicode_normalize(form = :nfc) -> String (6350.0)

self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列を返します。

...self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し
た文字列を返します。

@param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。

@raise Encoding::Comp...
...ode 文字列" とは、UTF-8、UTF-16BE/LE、
UTF-32BE/LE だけではなく GB18030、UCS_2BE、and UCS_4BE を含みます。

また、self が UTF-8 以外のエンコーディングであった場合は一度 UTF-8 に変
換してから正規化されるため、UTF-8 よりも遅くなって...
...list[例][ruby]{
"a\u0300".unicode_normalize # => 'à' ("\u00E0" と同じ)
"a\u0300".unicode_normalize(:nfc) # => 'à' ("\u00E0" と同じ)
"\u00E0".unicode_normalize(:nfd) # => 'à' ("a\u0300" と同じ)
"\xE0".force_encoding('ISO-8859-1').unicode_normalize(:nfd)...

String#unicode_normalized?(form = :nfc) -> bool (6314.0)

self が引数 form で指定された正規化形式で Unicode 正規化された文字列か どうかを返します。

...self が引数 form で指定された正規化形式で Unicode 正規化された文字列か
どうかを返します。

@param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。

@raise Encoding::Co...
...//emlist[例][ruby]{
"a\u0300".unicode_normalized? # => false
"a\u0300".unicode_normalized?(:nfd) # => true
"\u00E0".unicode_normalized? # => true
"\u00E0".unicode_normalized?(:nfd) # => false
"\xE0".force_encoding('ISO-8859-1').unicode_normalized?...
...# => Encoding::CompatibilityError raised
//}

@see String#unicode_normalize, String#unicode_normalize!...

String#unicode_normalize!(form = :nfc) -> self (6302.0)

self を NFC、NFD、NFKC、NFKD のいずれかの正規化形式で Unicode 正規化し た文字列に置き換えます。

...code 正規化し
た文字列に置き換えます。

(gsub!などと異なり)変換が行なわれなくても self を返します。

@param form 正規化形式を :nfc、:nfd、:nfkc、:nfkd のいずれかで指定しま
す。省略した場合は :nfc になります。

@rais...
...に発生します。

//emlist[例][ruby]{
text = "a\u0300"
text.unicode_normalize!(:nfc)
text == "\u00E0" # => true
text.unicode_normalize!(:nfd)
text == "a\u0300" # => true
//}

@see String#unicode_normalize, String#unicode_normalized?...

Encoding.locale_charmap -> String | nil (6220.0)

ロケールエンコーディングを決定するために用いる、locale charmap 名を返します。nl_langinfo 等がない環境では nil を、miniruby では ASCII_8BIT を返します。

...locale charmap 名を返します。nl_langinfo 等がない環境では nil を、miniruby では ASCII_8BIT を返します。

//emlist[Debian GNU/Linux + LANG=C][ruby]{
Encoding.locale_charmap #=> "ANSI_X3.4-1968"
//}

//emlist[LANG=ja_JP.EUC-JP][ruby]{
Encoding.locale_charmap #=> "EUC-JP"
//}...
...//emlist[SunOS 5 + LANG=C][ruby]{
Encoding.locale_charmap #=> "646"
//}

//emlist[SunOS 5 + LANG=ja][ruby]{
Encoding.locale_charmap #=> "eucJP"
//}

@see charmap(5)...

絞り込み条件を変える

Array#permutation(n = self.length) -> Enumerator (6202.0)

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

...permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permu...
...ation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

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

@see Array#combination, Array#repeated_permutation...

Array#permutation(n = self.length) { |p| block } -> self (6202.0)

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

...permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(0).to_a #=> [[]]: one permu...
...ation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

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

@see Array#combination, Array#repeated_permutation...

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

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

...ated_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 permutatio...
...ロックを実
行して 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 (6202.0)

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

...ated_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 permutatio...
...ロックを実
行して 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...

Hash#transform_keys -> Enumerator (6202.0)

すべてのキーに対してブロックを呼び出した結果で置き換えたハッシュを返します。 値は変化しません。

...transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(&:to_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys!
@see Hash#transform_values...
...@see Hash#transform_values!...
...//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys(&:to_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }...
...# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}

@see Hash#transform_keys!
@see Hash#transform_values
@see Hash#transform_values!...

絞り込み条件を変える

<< 1 2 3 ... > >>