Module: Schema::AttributeMacro::Defaults

Defined in:
lib/schema/schema.rb

Class Method Summary collapse

Class Method Details

.checkObject



53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/schema/schema.rb', line 53

def self.check
  lambda do |type, val|
    return true if val.nil?

    if type == Boolean
      Boolean.(val)
    elsif !type.nil?
      val.is_a?(type)
    else
      true
    end
  end
end