Sha256: 936b73ffc0aa125f3ea82e8f5cd952a3758b26f7585938c3fcc5ff92ccf49e1c
Contents?: true
Size: 481 Bytes
Versions: 19
Compression:
Stored size: 481 Bytes
Contents
module Bitstamp module Helper def self.parse_objects!(string, klass) # If Bitstamp returned nothing (which it does if the results yield empty) 'cast' it to an array string = "[]" if string == "" objects = JSON.parse(string) objects.collect do |t_json| parse_object!(t_json, klass) end end def self.parse_object!(object, klass) object = JSON.parse(object) if object.is_a? String klass.new(object) end end end
Version data entries
19 entries across 19 versions & 6 rubygems