|
|
||
--------------------------------------------------------- Class: Numeric Numeric is a built-in class on which Fixnum, Bignum, etc., are based. Here some methods are added so that all number types can be treated to some extent as Complex numbers. ------------------------------------------------------------------------ Includes: --------- Comparable(<, <=, ==, >, >=, between?) Instance methods: ----------------- @, -@, <=>, abs, angle, arg, ceil, coerce, conj, conjugate, div, divmod, eql?, floor, im, imag, image, integer?, modulo, nonzero?, polar, quo, real, remainder, round, singleton_method_added, step, to_int, truncate, zero?
==== Numeric ==== Numeric は数値の抽象クラスです。Ruby では coerce メソッドを使うことによって異なる数値クラス間で演算を行うことができます。 演算や比較を行うメソッド( , -, *, /, <=>)などはサブクラスで定義されま す。また、効率のため Numeric のメソッドと同じメソッドがサブクラ スで再定義されている場合があります。 ---- Singleton methods ---- ---- Instance methods ---- @ -@ abs ceil clone coerce div divmod dup floor integer? modulo nonzero? quo remainder round step to_int truncate zero? ---- Singleton methods (inherited) ---- ---- Instance methods (inherited) ---- < <= == === =~ > >= __id__ __send__ _dump _load between? class display eql? equal? extend freeze frozen? hash id initialize initialize_copy inspect instance_eval instance_of? instance_variable_get instance_variable_set instance_variables is_a? kind_of? marshal_dump marshal_load method method_missing methods nil? object_id pretty_print pretty_print_cycle pretty_print_instance_variables private_methods protected_methods public_methods remove_instance_variable respond_to? send singleton_method_added singleton_method_removed singleton_method_undefined singleton_methods taint tainted? to_a to_ary to_hash to_s to_str type untaint