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

instance method Numeric#imag

imag -> 0[permalink][rdoc][edit]
imaginary -> 0Ruby 1.9.3 から
() → Numeric

0 を返します。

Complex では self の虚部を返すよう再定義されています。

p 12.imag   # => 0
p -12.imag  # => 0
p 1.2.imag  # => 0
p -1.2.imag # => 0

Numeric のサブクラスは必要に応じてこのメソッドを適切に再定義しなければなりません。

[SEE_ALSO] Numeric#realComplex#imag