るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle sizeof_ssize_t

ライブラリ

クラス

キーワード

検索結果

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

集合の要素をすべて削除し、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}>
//}...

DBM#replace(other) -> self (18220.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::NE...
...WDB)
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>...

GDBM#replace(other) -> self (18220.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 (18220.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',...
...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"}...

StringScanner#string -> String (9231.0)

スキャン対象にしている文字列を返します。

...mlist[例][ruby]{
require
'strscan'

s = StringScanner.new('test string')
s.string # => "test string"
//}

返り値は freeze されていません。

//emlist[例][ruby]{
require
'strscan'

s = StringScanner.new('test string')
s.string.frozen? # => false
//}

なお、このメソッドは String...
...仕様に依存したコードを書かないようにしましょう。

//emlist[例][ruby]{
require
'strscan'

str = 'test string'
s = StringScanner.new(str)
s.string == str # => true
s.string.eql?(str) # => true (将来は false になる可能性がある)
//}

また、返り値の文字列...
...かないでください。

//emlist[例][ruby]{
require
'strscan'

str = 'test string'
s = StringScanner.new(str)
s.string.replace("0123")
s.scan(/\w+/) # => "0123" (将来は "test" が返る可能性あり)
str # => "0123" (将来は "test string" が返る可能性あり)
//}...

絞り込み条件を変える

Pathname#sub_ext(replace) -> Pathname (6214.0)

拡張子を与えられた文字列で置き換えた Pathname オブジェクトを返します。

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

自身が拡張子を持たない場合は、与えられた文字列を拡張子として付加します。

@param replace 拡張子を文字列で指定します。

//emlist[例][ruby]{
require
"pathname"

Pathname('/usr/bin/shutdown').sub_ext('.rb...
...<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test.').sub_ext('.pdf') # => #<Pathname:/home/user/test..pdf>
Pathna...
...me('/home/user/.test').sub_ext('.pdf') # => #<Pathname:/home/user/.test.pdf>
Pathname('/home/user/test.tar.gz').sub_ext('.xz') # => #<Pathname:/home/user/test.tar.xz>
//}...

Pathname#sub(pattern, replace) -> Pathname (3214.0)

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。

...しい Pathname オブジェクトを生成し、返します。

@param pattern 置き換える文字列のパターンを指定します。

@param replace pattern で指定した文字列と置き換える文字列を指定します。

//emlist[例][ruby]{
require
'pathname'

path1 = Pathname('/...
...usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}

@see String#sub...

Pathname#sub(pattern) {|matched| ... } -> Pathname (3114.0)

self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。

...しい Pathname オブジェクトを生成し、返します。

@param pattern 置き換える文字列のパターンを指定します。

@param replace pattern で指定した文字列と置き換える文字列を指定します。

//emlist[例][ruby]{
require
'pathname'

path1 = Pathname('/...
...usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}

@see String#sub...