Method: Castkit::DataObject.cast
- Defined in:
- lib/castkit/data_object.rb
.cast(obj) ⇒ self
Casts a value into an instance of this class.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/castkit/data_object.rb', line 58 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 |