Sha256: 44e7e6a057c2725157b833f9612e418eabdd3d5ac06b8c9108d40cfe8e94c733
Contents?: true
Size: 965 Bytes
Versions: 3
Compression:
Stored size: 965 Bytes
Contents
module Speedos class Record include Mongoid::Document include Mongoid::Timestamps embeds_many :information field :success, type: Boolean field :log scope :successful, ->() { where(success: true) } def entries self.log['entries'] end def pages self.log['pages'].reject{ |p| p['id'].empty? }.map{ |p| page(p['id']) } end def page name Entries.new(entries.select{ |p| p["pageref"] == name }) end def export_har filename File.open(filename, 'w') { |f| f.write({log: self.log}.to_json)} end def refresh_information information = self.information information.destroy_all self.pages.each do |page| information.create( :page_name => page.name, :began_at => page.earliest_start_time, :finished_at => page.latest_end_time, :total_duration => page.total_load_time ) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
speedos-0.0.14 | lib/speedos/models/record.rb |
speedos-0.0.13 | lib/speedos/models/record.rb |
speedos-0.0.12 | lib/speedos/models/record.rb |