るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice
  3. string slice!
  4. string []
  5. openssl t61string

ライブラリ

クラス

キーワード

検索結果

<< < ... 2 3 4 >>

Rake::FileList#sub!(pattern, replace) -> self (140.0)

自身に含まれるファイルリストのそれぞれのエントリに対して String#sub を実行します。 自身を破壊的に変更します。

...自身に含まれるファイルリストのそれぞれのエントリに対して String#sub を実行します。
自身を破壊的に変更します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file_list = FileList['a.c', 'b....

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

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

...文字列のパターンを指定します。

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

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

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

@see String#sub...

UnboundMethod#arity -> Integer (61.0)

メソッドが受け付ける引数の数を返します。

...を返します。C 言語レベルで実装されたメソッドが可変長引数を
受け付ける場合、-1 を返します。

//emlist[例][ruby]{
class C
def one; end
def two(a); end
def three(*a); end
def four(a, b); end
def five(a, b, *c); end
def six(a, b, *c, &d); end...
...).arity #=> 2
p C.instance_method(:five).arity #=> -3
p C.instance_method(:six).arity #=> -3


String
.instance_method(:size).arity #=> 0
String
.instance_method(:replace).arity #=> 1
String
.instance_method(:squeeze).arity #=> -1
String
.instance_method(:count).arity #=> -1
//}...

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

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

...文字列のパターンを指定します。

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

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

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

@see String#sub...

Object#freeze -> self (31.0)

オブジェクトを凍結(内容の変更を禁止)します。

...数なら Kernel.#trace_var が使えます。

@return self を返します。

//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p a1 #=> "bar"

a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (RuntimeError)
//}

凍結を解除することはできませんが、Object#dup を使え...
...ばほぼ同じ内容の凍結されていない
オブジェクトを得ることはできます。

//emlist[][ruby]{
a = [1].freeze
p a.frozen? #=> true

a[0] = "foo"
p a # can't modify frozen Array (RuntimeError)

b = a.dup
p b #=> [1]
p b.frozen? #=> false

b[0]...
...数なら Kernel.#trace_var が使えます。

@return self を返します。

//emlist[][ruby]{
a1 = "foo".freeze
a1 = "bar"
p a1 #=> "bar"

a2 = "foo".freeze
a2.replace("bar") # can't modify frozen String (FrozenError)
//}

凍結を解除することはできませんが、Object#dup を使え...
...ばほぼ同じ内容の凍結されていない
オブジェクトを得ることはできます。

//emlist[][ruby]{
a = [1].freeze
p a.frozen? #=> true

a[0] = "foo"
p a # can't modify frozen Array (FrozenError)

b = a.dup
p b #=> [1]
p b.frozen? #=> false

b[0] =...

絞り込み条件を変える

<< < ... 2 3 4 >>