Method: Cloudinary::Utils.json_array_param
- Defined in:
- lib/cloudinary/utils.rb
.json_array_param(data) ⇒ String|nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a JSON array as String. Yields the array before it is converted to JSON format
524 525 526 527 528 529 530 531 |
# File 'lib/cloudinary/utils.rb', line 524 def self.json_array_param(data) return nil if data.nil? data = JSON.parse(data) if data.is_a?(String) data = [data] unless data.is_a?(Array) data = yield data if block_given? JSON.generate(data) end |