このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 3.0 リファレンスマニュアル

instance method Integer#<=

self <= other -> boolRuby 2.4.0 から[permalink][rdoc][edit]

self を数値として other と比較し、self が other より小さいか等しければ true を、そうでなければ false を返します。

other が Complex オブジェクトのとき、たとえ虚部がゼロでも NoMethodError が発生します。

other が NaN のとき、false を返します。

other が数値でないとき、ArgumentError が発生します。

Integer オブジェクトを左項とする比較演算子 <= はこのメソッドの呼び出しになります。

[PARAM] other:
比較対象の数値
[RETURN]
self が other より小さいか等しければ true を、そうでなければ false を返します。
p 1 <= 0  # => false
p 1 <= 1  # => true
p 1 <= 2  # => true

p 1 <= Float::NAN # => false

p 1 <= Complex(2, 0)  # ~> NoMethodError
p 1 <= "2" # ~> ArgumentError: comparison of Integer with String failed