lib/speed_gun/profiler.rb in speed_gun-0.0.1 vs lib/speed_gun/profiler.rb in speed_gun-0.0.2
- old
+ new
@@ -12,10 +12,14 @@
def self.load(id)
src = SpeedGun.store[id]
return nil unless src
- data = MessagePack.unpack(src)
+ restore(src)
+ end
+
+ def self.restore(src)
+ data = src.kind_of?(String) ? MessagePack.unpack(src) : src
profiler = new({})
profiler.restore_by_hash(data)
profiler