Module: Yema::Utils

Defined in:
lib/yema/utils/type_matcher.rb

Class Method Summary collapse

Class Method Details

.type_matches?(value, type) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
# File 'lib/yema/utils/type_matcher.rb', line 3

def self.type_matches?(value, type)
  if type == TrueClass || type == FalseClass
    value.equal?(true) || value.equal?(false)
  else
    value.kind_of?(type)
  end
end