Sha256: 67876fc3ffc50131747096f1c944f932a614d528c3f6701cf7918d64f86ca770
Contents?: true
Size: 686 Bytes
Versions: 1
Compression:
Stored size: 686 Bytes
Contents
require "json" module GeoDistance::Parser class Json class << self def get_customers_from_file(file_path) raw_data = GeoDistance::Input::File.get_file_content(file_path) raw_records = GeoDistance::Splitter::Character.split(raw_data, "\n") raw_records.map do |record| begin record_hash = JSON.parse(record) GeoDistance::Model::Customer.new(record_hash) rescue JSON::ParserError p "Parsing error occurred for row: #{record}" raise rescue ArgumentError p "Invalid data in row: #{record}" raise end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_distance-0.1.1 | lib/geo_distance/parser/json.rb |