るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Hash#replace(other) -> self (32215.0)

ハッシュの内容を other の内容で置き換えます。

...内容を other の内容で置き換えます。

デフォルト値の設定もotherの内容になります。
otherがハッシュではない場合、otherのメソッドto_hashを使って暗黙の変換を試みます。

self = other.to_hash.dup と同じです。

@param other ハッシュ...
...@return self を返します。

//emlist[例][ruby]{
foo = {1 => 'a', 2 => 'b'}
bar = {2 => 'B', 3 => 'C'}

foo.replace(bar)
p foo #=> {2=>"B", 3=>"C"}

zoo = {}
zoo = bar.dup
p zoo #=> {2=>"B", 3=>"C"}

class Foo
def to_hash
{:japan => 'kyoto'}
e
nd
e
nd

h = Hash.new
h.replace(Foo.new) #...
...暗黙の変換
p h #=> {:japan=>"kyoto"}
//}

@see Hash#dup,Hash#merge,Object#to_hash...

Array#replace(another) -> self (32209.0)

配列の内容を配列 another の内容で置き換えます。

...の内容を配列 another の内容で置き換えます。

@param another 配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary メソッドに
よる暗黙の型変換を試みます。

@raise TypeError 引数に配列以外...
...の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.replace [4, 5, 6]
p a #=> [4, 5, 6]
//}...

String#replace(other) -> String (32209.0)

self の内容を other の内容で置き換えます。

...self の内容を other の内容で置き換えます。

//emlist[例][ruby]{
str = "foo"
str.replace "bar"
p str # => "bar"
//}...

ENV.replace(hash) -> ENV (32203.0)

環境変数を hash と同じ内容に変更します。 self を返します。

...環境変数を hash と同じ内容に変更します。 self を返します。

@param hash キーと値の対応関係を指定します。 to_hash でハッシュに変換されます。...

Encoding::Converter#replacement=(string) (23208.0)

置換文字を設定します。

...置換文字を設定します。

@param string 変換器に設定する置換文字

//emlist[][ruby]{
e
c = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
e
c.replacement = "<undef>"
p ec.convert("a \u3042 b") #=> "a <undef> b"
//}...

絞り込み条件を変える

Encoding::Converter#replacement -> String (23202.0)

変換器に設定されている置換文字を返します。

...器に設定されている置換文字を返します。

@return 変換器に設定されている置換文字

//emlist[][ruby]{
e
c = Encoding::Converter.new("euc-jp", "us-ascii")
p ec.replacement #=> "?"

e
c = Encoding::Converter.new("euc-jp", "utf-8")
p ec.replacement #=> "\uFFFD"
//}...

String#encode(encoding, from_encoding, **options) -> String (14364.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

...self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、En...
...coding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

@param encoding 変換先のエンコーディングを表...
...す文字列か Encoding オブジェクトを指定します。
@param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param option 変換オプションをキーワード引数で与えます。
@return...

Hash#merge!(*others) {|key, self_val, other_val| ... } -> self (14308.0)

selfとothersのハッシュの内容を順番にマージ(統合)します。

...selfとothersのハッシュの内容を順番にマージ(統合)します。

デフォルト値はselfの設定のままです。

self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを呼び...
...に others の値を使います。

othersがハッシュではない場合、othersのメソッドto_hashを使って暗黙の変換を試みます。

@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マー...
...ジ後のselfを返します。

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h1.merge! #=> {"a"=>100, "b"=>200}
h1 #=> {"a"=>100, "b"=>200}
//}

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h1.merge!(h2) #=> {"a"=>100, "b"=>246...

Hash#merge(*others) {|key, self_val, other_val| ... } -> Hash (14308.0)

selfとothersのハッシュの内容を順番にマージ(統合)した結果を返します。 デフォルト値はselfの設定のままです。

...selfとothersのハッシュの内容を順番にマージ(統合)した結果を返します。
デフォルト値はselfの設定のままです。

self と others に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブ...
...に others の値を使います。

othersがハッシュではない場合、othersのメソッドto_hashを使って暗黙の変換を試みます。

@param others マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マー...
...//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 246, "c" => 300 }
h3 = { "b" => 357, "d" => 400 }
h1.merge #=> {"a"=>100, "b"=>200}
h1.merge(h2) #=> {"a"=>100, "b"=>246, "c"=>300}
h1.merge(h2, h3) #=> {"a"=>100, "b"=>357, "c"=>300, "d"=>400}
h1.merge(h2) {|key, oldva...

Hash#merge(other) {|key, self_val, other_val| ... } -> Hash (14308.0)

selfとotherのハッシュの内容をマージ(統合)した結果を返します。デフォルト値はselfの設定のままです。

...selfとotherのハッシュの内容をマージ(統合)した結果を返します。デフォルト値はselfの設定のままです。

self と other に同じキーがあった場合はブロック付きか否かで
判定方法が違います。ブロック付きのときはブロックを...
...常に other の値を使います。

otherがハッシュではない場合、otherのメソッドto_hashを使って暗黙の変換を試みます。

@param other マージ用のハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@return マー...
...ジした結果を返します

//emlist[][ruby]{
h1 = { "a" => 100, "b" => 200 }
h2 = { "b" => 254, "c" => 300 }
h1.merge() # => {"a"=>100, "b"=>200}
h1.merge(h2) # => {"a"=>100, "b"=>254, "c"=>300}
h1.merge(h2){|key, oldval, newval| newval - oldval}
# => {"a"=>100, "b"=>54, "...

絞り込み条件を変える

String#encode(encoding, **options) -> String (14264.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

...self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、En...
...coding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

@param encoding 変換先のエンコーディングを表...
...す文字列か Encoding オブジェクトを指定します。
@param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param option 変換オプションをキーワード引数で与えます。
@return...
<< 1 2 3 ... > >>