るりまサーチ

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

別のキーワード

  1. open3 popen2e
  2. socket af_e164
  3. matrix det_e
  4. matrix rank_e
  5. open3 capture2e

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

GDBM#replace(other) -> self (24431.0)

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

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

@param other each_pair メソッドを持つオブジェクトでなければなりません。

require 'gdbm'

db1 = GDBM.open('aaa.gdbm', 0666, GDBM::NEWDB)
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db2 = GDBM.open('bbb.gdbm', 0666,...
...GDBM::NEWDB)
db2['c'] = 'ccc'
db2['d'] = 'ddd'
hash = { 'x' => 'xxx', 'y' => 'yyy'}

p db1 #=> #<GDBM:0xb7d1c8a8>
p db1.replace(db2) #=> #<GDBM:0xb7d1c8a8>
p db1.replace(hash) #=> #<GDBM:0xb7d1c8a8>...

SDBM#replace(other) -> self (24431.0)

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

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

@param other each_pair メソッドを持つオブジェクトでなければなりません。

require 'sdbm'

db1 = SDBM.open('aaa.gdbm', 0666)
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'
db2 = SDBM.open('bbb.gdbm',...
...> 'xxx', 'y' => 'yyy'}

p db1 #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}
p db1.replace(db2) #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=> {"c"=>"ccc", "d"=>"ddd"}
p db1.replace(hash) #=> #<SDBM:0xb7c304d0>
p db1.to_hash #=>...
...{"x"=>"xxx", "y"=>"yyy"}...

DBM#replace(other) -> self (24425.0)

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

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

@param other each_pair メソッドを持つオブジェクトでなければなりません。

require 'dbm'

db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
db2 = DBM.open('bbb.db', 0666, DBM::NEW...
...DB)
db2[:bb] = 'bbb'
db2[:cc] = 'ccc'

p db1.keys #=> ['b', 'a']

db1.replace(db2)

p db1.keys #=> ['bb', 'cc']
p db2.keys #=> ['bb', 'cc']

hash = {'x' => 'xxx', 'y' => 'yyy' }
p db1 #=> #<DBM:0xb7c7eb08>
p db1.replace(hash) #=> #<DBM:0xb7c7eb08>...

Hash#replace(other) -> self (24413.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 (24407.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]
//}...

絞り込み条件を変える

Set#replace(enum) -> self (24407.0)

集合の要素をすべて削除し、enum で与えられた要素に置き換えます。

...削除し、enum で与えられた要素に置き換えます。

引数 enum には each メソッドが定義されている必要があります。

@param enum 置き換え後の集合要素を格納するオブジェクトを指定します。
@raise ArgumentError 引数 enum に each メソ...
...ッドが定義されていない場合に
発生します。

//emlist[][ruby]{
require 'set'
p s = Set[10, 20, 30] # => #<Set: {10, 20, 30}>
s.replace([15, 25])
p s # => #<Set: {15, 25}>
//}...

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

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

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

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

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

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

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

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

YAML::DBM#replace(other) -> YAML::DBM (24401.0)

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

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

@param other Hash、DBM オブジェクトを指定します。

@raise DBMError 更新に失敗した場合に発生します。

自身を返します。...

Encoding::Converter#replacement -> String (15424.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"
//}...

絞り込み条件を変える

<< 1 2 3 ... > >>