るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

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

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

@param other ハッシュまたはメソッド to_hash でハッシュに変換できるオブジェクトです。
@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'}
end
end

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

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

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

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

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

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

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

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

Array#replace(another) -> self (24220.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 (24220.0)

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

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

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

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

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

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

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

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

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

絞り込み条件を変える

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

置換文字を設定します。

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

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

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

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

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

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

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

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

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

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

@see String#sub...

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

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

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

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

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

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

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

@see String#sub...

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

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

...列で置き換えた Pathname オブジェクトを返します。

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

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

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

P
athname('/usr/bin/sh...
...#<Pathname:/usr/bin/shutdown.rb>
P
athname('/home/user/test.txt').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
P
athname('/home/user/test').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
P
athname('/home/user/test.').sub_ext('.pdf') # => #<Pathname:/home/user/test..pdf>
P
ath...
...name('/home/user/.test').sub_ext('.pdf') # => #<Pathname:/home/user/.test.pdf>
P
athname('/home/user/test.tar.gz').sub_ext('.xz') # => #<Pathname:/home/user/test.tar.xz>
//}...
<< 1 2 3 ... > >>