Sha256: 62bd72b35f50bde229c12c0c44cb47f19c41e895a550e0a811a04d33e24c7abb

Contents?: true

Size: 342 Bytes

Versions: 7

Compression:

Stored size: 342 Bytes

Contents

module Bitstamp
  module Helper
    def self.parse_objects!(string, klass)
      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

7 entries across 7 versions & 1 rubygems

Version Path
bitstamp-0.2.6 lib/bitstamp/helper.rb
bitstamp-0.2.5 lib/bitstamp/helper.rb
bitstamp-0.2.4 lib/bitstamp/helper.rb
bitstamp-0.2.3 lib/bitstamp/helper.rb
bitstamp-0.2.2 lib/bitstamp/helper.rb
bitstamp-0.2.1 lib/bitstamp/helper.rb
bitstamp-0.2.0 lib/bitstamp/helper.rb