Module: Numericlike

Defined in:
lib/composite_type.rb

Overview

Objects that are Numeric or respond to :to_numeric.

Class Method Summary collapse

Class Method Details

.===(x) ⇒ Object



201
202
203
204
205
206
207
208
# File 'lib/composite_type.rb', line 201

def self.=== x
  case
  when Numeric === x
    x
  when x.respond_to?(:to_numeric)
    x.to_numeric
  end
end