Module: Puree::Model::Validation

Defined in:
lib/puree/model/helper/validation.rb

Overview

Model validation.

Instance Method Summary collapse

Instance Method Details

#enforce_class(v, klass) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
# File 'lib/puree/model/helper/validation.rb', line 7

def enforce_class(v, klass)
  raise ArgumentError, "Expected #{klass}. Got #{v.class}." unless v && v.is_a?(klass)
end