るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Module#<(other) -> bool | nil (29238.0)

比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。

...比較演算子。self が other の子孫である場合、 true を返します。
self が other の先祖か同一のクラス/モジュールである場合、false を返します。

継承関係にないクラス同士の比較では
nil を返します。

@param other 比較対象のモ...
...ラス

@raise TypeError other がクラスやモジュールではない場合に発生します。

//emlist[例][ruby]{
module Foo
e
nd
class Bar
include Foo
e
nd
class Baz < Bar
e
nd
class Qux
e
nd
p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => n...
...il
p Baz > Qux # => nil

p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}...

Comparable#<(other) -> bool (29214.0)

比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が負の整数を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。

... <=> をもとにオブジェクト同士を比較します。
<
=> が負の整数を返した場合に、true を返します。
それ以外の整数を返した場合に、false を返します。

@param other 自身と比較したいオブジェクトを指定します。
@raise ArgumentError <...
...=> が nil を返したときに発生します。

//emlist[例][ruby]{
1 < 1 # => false
1 < 2 # => true
//}...

Integer#<(other) -> bool (29214.0)

比較演算子。数値として小さいか判定します。

...比較演算子。数値として小さいか判定します。

@param other 比較対象の数値
@return self よりも other が大きい場合 true を返します。
そうでなければ false を返します。

//emlist[][ruby]{
1 < 1 # => false
1 < 2 # => true
//}...

Complex#<(other) -> bool (29202.0)

@undef

...@undef...

Hash#<(other) -> bool (26220.0)

self が other のサブセットである場合に真を返します。

...self が other のサブセットである場合に真を返します。

@param other 自身と比較したい Hash オブジェクトを指定します。

//emlist[例][ruby]{
h1 = {a:1, b:2}
h2 = {a:1, b:2, c:3}
h1 < h2 # => true
h2 < h1 # => false
h1 < h1 # => false
//}

@see Hash#<=,...

絞り込み条件を変える

Float#<(other) -> bool (26208.0)

比較演算子。数値として小さいか判定します。

...数値として小さいか判定します。

@param other 比較対象の数値
@return self よりも other が大きい場合 true を返します。
そうでなければ false を返します。

//emlist[例][ruby]{
3.14 < 3.1415 # => true
3.14 <= 3.1415 # => true
//}...

Fixnum#<(other) -> bool (26202.0)

比較演算子。数値として小さいか判定します。

...比較演算子。数値として小さいか判定します。

@param other 比較対象の数値
@return self よりも other が大きい場合 true を返します。
そうでなければ false を返します。...

Module#<=>(other) -> Integer | nil (17308.0)

self と other の継承関係を比較します。

...self と other の継承関係を比較します。

self と other を比較して、
self が other の子孫であるとき -1、
同一のクラス/モジュールのとき 0、
self が other の先祖であるとき 1
を返します。

継承関係にないクラス同士の比較では
n...
...other がクラスやモジュールでなければ
nil を返します。

@param other 比較対象のクラスやモジュール

//emlist[例][ruby]{
module Foo
e
nd
class Bar
include Foo
e
nd
class Baz < Bar
e
nd
class Qux
e
nd
p Bar <=> Foo # => -1
p Baz <=> Bar # => -1
p Baz <=> Foo...
...# => -1
p Baz <=> Qux # => nil
p Qux <=> Baz # => nil

p Baz <=> Object.new # => nil
//}...

Thread.report_on_exception -> bool (17220.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...tderr に報告します。

デフォルトは false です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <m...
...ain>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

* 例外が意図...
...で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレ...
...tderr に報告します。

デフォルトは true です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <ma...
...in>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

* 例外が意図し...

Thread.report_on_exception=(newstate) (17220.0)

真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。

...tderr に報告します。

デフォルトは false です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <m...
...ain>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

* 例外が意図...
...で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception = false でレ...
...tderr に報告します。

デフォルトは true です。

Thread.new { 1.times { raise } }

は $stderr に以下のように出力します:

#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block in <ma...
...in>'
1: from -e:1:in `times'

これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:

* 例外が意図し...

絞り込み条件を変える

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

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

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

to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
E
numerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が...
...o_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。

//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given...
...n.times { yield *val }
e
nd
e
lse
to_enum(:repeat, n)
e
nd
e
nd
e
nd

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

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

# Lazy#to_enum のおかげで、repeat の返り...
<< 1 2 3 ... > >>