別のキーワード
種類
- インスタンスメソッド (163)
- 文書 (62)
- モジュール関数 (11)
- クラス (11)
クラス
- Float (20)
- Integer (66)
- Object (44)
- String (11)
-
Thread
:: ConditionVariable (22)
モジュール
- Process (11)
キーワード
- * (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 5 . 0 (7) - Numeric (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- broadcast (11)
-
clock
_ gettime (11) - downto (22)
-
enum
_ for (22) -
next
_ float (10) -
prev
_ float (10) - signal (11)
-
to
_ enum (22) - upto (22)
- クラス/メソッドの定義 (11)
- 制御構造 (11)
- 変数と定数 (11)
検索結果
先頭5件
-
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...