るりまサーチ

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

別のキーワード

  1. matrix each_with_index
  2. _builtin with_index
  3. mkmf with_werror
  4. mkmf with_config
  5. prime with_index

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

Data#with(**kwargs) -> Data (18128.0)

self をコピーしたオブジェクトを返します。

...設定されます。存在しないメンバを指定した場合はエラーとなります。

@
param kwargs コピーされたオブジェクトに設定されるメンバの値を指定します。

@
raise ArgumentError 存在しないメンバを指定した場合に発生します。

//emlis...
...me, :age)
dog1 = Dog.new("Fred", 5) # => #<data Dog name="Fred", age=5>
dog2 = dog1.with(age: 6) # => #<data Dog name="Fred", age=6>
p dog1 # => #<data Dog name="Fred", age=5>
dog3 = dog1.with(type: "Terrier") # => ArgumentError (unknown keyword: :type)

# メンバのオブ...

Symbol#start_with?(*prefixes) -> bool (6164.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...ます。

(self.to_s.start_with?と同じです。)

@
param prefixes パターンを表す文字列または正規表現 (のリスト)

@
see Symbol#end_with?

@
see String#start_with?

//emlist[][ruby]{
:hello.start_with?("hell") #=> true
:hello.start_with?(/H/i) #=> t...
...rue

# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}...

String#start_with?(*prefixes) -> bool (6158.0)

self の先頭が prefixes のいずれかであるとき true を返します。

...返します。

@
param prefixes パターンを表す文字列または正規表現 (のリスト)

//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?("ing", "str") # => true
"string".start_with?(/\w/)...
...# => true
"string".start_with?(/\d/) # => false
//}

@
see String#end_with?
@
see String#delete_prefix, String#delete_prefix!...

Symbol#end_with?(*suffixes) -> bool (6158.0)

self の末尾が suffixes のいずれかであるとき true を返します。

...(self.to_s.end_with?と同じです。)

@
param suffixes パターンを表す文字列 (のリスト)

@
see Symbol#start_with?

@
see String#end_with?

//emlist[][ruby]{
:hello.end_with?("ello") #=> true

# returns true if one of the +suffixes+ matches.
:hello.end_with?("heaven", "ell...
...o") #=> true
:hello.end_with?("heaven", "paradise") #=> false
//}...

Enumerable#each_with_index(*args) -> Enumerator (6147.0)

要素とそのインデックスをブロックに渡して繰り返します。

...繰り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのま...
...each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see Enumerator#with_index...

絞り込み条件を変える

Enumerable#each_with_index(*args) {|item, index| ... } -> self (6147.0)

要素とそのインデックスをブロックに渡して繰り返します。

...繰り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@
param args イテレータメソッド (each など) にそのま...
...each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz", 2]
//}

@
see Enumerator#with_index...

String#end_with?(*strs) -> bool (6146.0)

self の末尾が strs のいずれかであるとき true を返します。

...true を返します。

@
param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}

@
see String#start_with?
@
see String#delete_suffix,...

Enumerator#with_object(obj) -> Enumerator (6141.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}

@
param obj 繰り返しの各要素に添えて渡されるオブジェクト
@
see Enumerable#each_with_object...

Enumerator#with_object(obj) {|(*args), memo_obj| ... } -> object (6141.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}

@
param obj 繰り返しの各要素に添えて渡されるオブジェクト
@
see Enumerable#each_with_object...

String#end_with?(*strs) -> bool (6140.0)

self の末尾が strs のいずれかであるとき true を返します。

...ずれかであるとき true を返します。

@
param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".end_with?("ing") # => true
"string".end_with?("str") # => false
"string".end_with?("str", "ing") # => true
//}

@
see String#start_with?...

絞り込み条件を変える

String#start_with?(*strs) -> bool (6140.0)

self の先頭が strs のいずれかであるとき true を返します。

...れかであるとき true を返します。

@
param strs パターンを表す文字列 (のリスト)

//emlist[例][ruby]{
"string".start_with?("str") # => true
"string".start_with?("ing") # => false
"string".start_with?("ing", "str") # => true
//}

@
see String#end_with?...

Enumerable#each_with_object(obj) -> Enumerator (6129.0)

与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。

...返します。

ブロックを省略した場合は Enumerator を返します。

@
param obj 任意のオブジェクトを指定します。

//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@
see Enumerator#with_object...

Enumerable#each_with_object(obj) {|(*args), memo_obj| ... } -> object (6129.0)

与えられた任意のオブジェクトと要素をブロックに渡し繰り返し、最初に与えられたオブジェクトを返します。

...返します。

ブロックを省略した場合は Enumerator を返します。

@
param obj 任意のオブジェクトを指定します。

//emlist[例][ruby]{
evens = (1..10).each_with_object([]) {|i, a| a << i*2 }
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@
see Enumerator#with_object...
<< 1 2 3 ... > >>