るりまサーチ

最速Rubyリファレンスマニュアル検索!
247件ヒット [1-100件を表示] (0.022秒)
トップページ > クエリ:self[x] > クエリ:times[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

検索結果

<< 1 2 3 > >>

Integer#times {|n| ... } -> self (18259.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...
self
回だけ繰り返します。
self
が正の整数でない場合は何もしません。

またブロックパラメータには 0 から self - 1 までの数値が渡されます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.t...
...imes { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@see Integer#upto, Integer#downto, Numeric#step...

Integer#times -> Enumerator (18159.0)

self 回だけ繰り返します。 self が正の整数でない場合は何もしません。

...
self
回だけ繰り返します。
self
が正の整数でない場合は何もしません。

またブロックパラメータには 0 から self - 1 までの数値が渡されます。

//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.t...
...imes { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}

@see Integer#upto, Integer#downto, Numeric#step...

Integer#downto(min) {|n| ... } -> self (145.0)

self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。

...
self
から min まで 1 ずつ減らしながらブロックを繰り返し実行します。
self
< min であれば何もしません。

@param min 数値
@return self を返します。

//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}

@see Integer#upto, Numeric#ste...
...p, Integer#times...

1.6.8から1.8.0への変更点(まとめ) (144.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...ました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;

class << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]...
...さあっぱりわかりません(^^;;

class << Object.new
class << self.superclass
p [self.id, self]
end
class << self
p [self.superclass.id, self.superclass]
end
end
=> ruby 1.6.7 (2002-03-01) [i586-linux]...
...ThreadGroup に Thread を追加/削除できなくなりました。

=== Time

: ((<Process/Process.times>)) [change]
((<Time/Time.times>)) から移動しました。
(Time.times も残っていますが、warningが出ます)

: ((<Time#to_a|Time/to_a>)) [change]
: ((<Time#z...

String#*(times) -> String (135.0)

文字列の内容を times 回だけ繰り返した新しい文字列を作成して返します。

...文字列の内容を times 回だけ繰り返した新しい文字列を作成して返します。

@param times 整数
@return self times 回繰り返した新しい文字列

@raise ArgumentError 引数に負数を指定したときに発生します。

//emlist[例][ruby]{
p "s...

絞り込み条件を変える

Thread::ConditionVariable#broadcast -> self (113.0)

状態変数を待っているスレッドをすべて再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。

...ad::ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wait(...

Thread::ConditionVariable#signal -> self (113.0)

状態変数を待っているスレッドを1つ再開します。再開された スレッドは Thread::ConditionVariable#wait で指定した mutex のロックを試みます。

...ad::ConditionVariable#wait
で指定した mutex のロックを試みます。

@return 常に self を返します。

//emlist[例][ruby]{
mutex = Mutex.new
cv = ConditionVariable.new
flg = true

3.times {
Thread.start {
mutex.synchronize {
puts "a1"
while (flg)
cv.wait(...

クラス/メソッドの定義 (66.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...ークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}

クラス定義式の中は self がそのクラスであることと、
limitのデフォルトが異なること以外
にトップレベルとの違いはありません。クラ...
...す。
ブロックが与えられなかった場合のブロック引数の値はnilです。

//emlist[例][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}...
...の外でも良い
def Hoge.bar
end

# 以下のようにすればクラス名が変わってもメソッド部の変更が不要
class Hoge
def self.baz
'To infinity and beyond!'
end
end

# 特異クラス方式。複数のメソッドを一度に定義するとき向き
class << Hoge
def...

Numeric (60.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...- - - -
succ | - o o - - - -
times
| - o - - - - -
to_c | o - -...
...**d
if self > 0
self
.quo(x).ceil * x
else
self
.quo(x).floor * x
end
end

def rounddown(d=0)
x = 10**d
if self < 0
self
.quo(x).ceil * x
else
self
.quo(x).floor * x
end
end

def roundoff(d=0)
x = 10**d
if self < 0
(self.quo(x) -...
...0.5).ceil * x
else
(self.quo(x) + 0.5).floor * x
end
end
end
//}...
...step | o - - - -
succ | - o - - -
times
| - o - - -
to_c | o - - - o...

クラス/メソッドの定義 (54.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...ークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}

クラス定義式の中は self がそのクラスであることと、
limitのデフォルトが異なること以外
にトップレベルとの違いはありません。クラ...
...す。
ブロックが与えられなかった場合のブロック引数の値はnilです。

//emlist[例][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}...
...の外でも良い
def Hoge.bar
end

# 以下のようにすればクラス名が変わってもメソッド部の変更が不要
class Hoge
def self.baz
'To infinity and beyond!'
end
end

# 特異クラス方式。複数のメソッドを一度に定義するとき向き
class << Hoge
def...

絞り込み条件を変える

Integer#downto(min) -> Enumerator (45.0)

self から min まで 1 ずつ減らしながらブロックを繰り返し実行します。 self < min であれば何もしません。

...
self
から min まで 1 ずつ減らしながらブロックを繰り返し実行します。
self
< min であれば何もしません。

@param min 数値
@return self を返します。

//emlist[][ruby]{
5.downto(1) {|i| print i, " " } # => 5 4 3 2 1
//}

@see Integer#upto, Numeric#ste...
...p, Integer#times...
<< 1 2 3 > >>