Method: Castkit::DataObject.cast
- Defined in:
- lib/castkit/data_object.rb
.cast(obj) ⇒ self
Casts a value into an instance of this class.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/castkit/data_object.rb', line 77 def cast(obj) case obj when self obj when Hash from_h(obj) else raise Castkit::DataObjectError, "Can't cast #{obj.class} to #{name}" end end |