Module: Numericlike

Defined in:
lib/typed_attr/composite_type.rb

Overview

Objects that are Numeric or respond to :to_numeric.

Class Method Summary collapse

Class Method Details

.===(x) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/typed_attr/composite_type.rb', line 101

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