Method: JSI::JSICoder#dump
- Defined in:
- lib/jsi/jsi_coder.rb
#dump(object) ⇒ Object, ...
Returns the schema instance(s) of the JSI(s), or nil if object is nil.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/jsi/jsi_coder.rb', line 56 def dump(object) return nil if object.nil? jsonifiable = begin if @array unless object.respond_to?(:to_ary) raise(TypeError, "expected array-like attribute; got: #{object.class}: #{object.inspect}") end object.map do |el| dump_object(el) end else dump_object(object) end end jsonifiable end |