るりまサーチ

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

別のキーワード

  1. _builtin times
  2. integer times
  3. process times
  4. times _builtin

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 ... > >>

Kernel#modified?(target, times) -> Time | nil (124.0)

target が times の全ての要素よりも新しい場合は target の更新時刻を返します。 そうでない場合は nil を返します。target が存在しない場合も nil を返します。

...target が times の全ての要素よりも新しい場合は target の更新時刻を返します。
そうでない場合は nil を返します。target が存在しない場合も nil を返します。

@param target 対象のファイル名を指定します。

@param times Time の配列...

ARGF.class#eof -> bool (7.0)

現在開いているファイルがEOFに達したらtrueを返します。そうでない場合は falseを返します。

...IOError ファイルがopenされていない場合に発生します。

$ echo "eof" | ruby argf.rb

ARGF.eof? # => false
3.times { ARGF.readchar }
ARGF.eof? # => false
ARGF.readchar # => "\n"
ARGF.eof? # => true

@see IO#eof,...

ARGF.class#eof? -> bool (7.0)

現在開いているファイルがEOFに達したらtrueを返します。そうでない場合は falseを返します。

...IOError ファイルがopenされていない場合に発生します。

$ echo "eof" | ruby argf.rb

ARGF.eof? # => false
3.times { ARGF.readchar }
ARGF.eof? # => false
ARGF.readchar # => "\n"
ARGF.eof? # => true

@see IO#eof,...

Binding#local_variables -> [Symbol] (7.0)

ローカル変数の一覧を Symbol の配列で返します。

...ローカル変数の一覧を Symbol の配列で返します。

//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}

このメソッドは以下のコードと同様の動作をします。

//emlist[][ruby]{
binding.eval("local_variables"...

Enumerator#next -> object (7.0)

「次」のオブジェクトを返します。

...列挙状態が既に最後へ到達しているとき
@see Enumerator#rewind

//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte

str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122
//}

//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte

begin
puts enum.next...

絞り込み条件を変える

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

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

...obj を返す Enumerator を返します。

//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}"
e...

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

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

...obj を返す Enumerator を返します。

//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}"
e...

Enumerator::Lazy#enum_for(method = :each, *args) -> Enumerator::Lazy (7.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]...

Enumerator::Lazy#enum_for(method = :each, *args) {|*args| block} -> Enumerator::Lazy (7.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end

r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]...
<< < 1 2 3 4 ... > >>