lib/sched/client.rb in sched-0.1.7 vs lib/sched/client.rb in sched-0.1.8
- old
+ new
@@ -47,13 +47,20 @@
c = curl_client("#{path}?#{get_attributes}")
c.perform
c.body_str
end
- def parse_sessions(results)
- attributes = results.shift.map do |a|
- a.strip.gsub(/[\u0080-\u00ff]/, "").gsub(/^event_/, "session_").to_sym
+ def parse_attributes(attributes)
+ attributes.map do |a|
+ a.force_encoding("UTF-8")
+ .strip.gsub(/[\u0080-\u00ff]/, "")
+ .gsub(/^event_/, "session_")
+ .to_sym
end
+ end
+
+ def parse_sessions(results)
+ attributes = parse_attributes(results.shift)
results.map do |row|
row_hash = {}
attributes.each_with_index do |a, i|
row_hash[a] = row[i]
end