るりまサーチ

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

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

クラス

検索結果

StringScanner#string=(str) (18113.0)

スキャン対象の文字列を str に変更して、マッチ記録を捨てます。

...す。

@param str スキャン対象の文字列を str に変更して、マッチ記録を捨てます。

@return str を返します。

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

str = '0123'
s = StringScanner.new('test string')
s.string = str # => "0123"
s.scan(/\w+/) # => "0123"
//}...

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

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

...erator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times 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
# =>...

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

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

...erator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times 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
# =>...