Sha256: 525db65baf028719c4f0e24ecd49c5ed3db50d42519dd9c8420996b70099dd2c
Contents?: true
Size: 1.12 KB
Versions: 33
Compression:
Stored size: 1.12 KB
Contents
class Puppeteer::Page class Metrics SUPPORTED_KEYS = Set.new([ 'Timestamp', 'Documents', 'Frames', 'JSEventListeners', 'Nodes', 'LayoutCount', 'RecalcStyleCount', 'LayoutDuration', 'RecalcStyleDuration', 'ScriptDuration', 'TaskDuration', 'JSHeapUsedSize', 'JSHeapTotalSize', ]).freeze SUPPORTED_KEYS.each do |key| attr_reader key end # @param metrics_result [Hash] response for Performance.getMetrics def initialize(metrics_response) metrics_response.each do |metric| if SUPPORTED_KEYS.include?(metric['name']) instance_variable_set(:"@#{metric['name']}", metric['value']) end end end def [](key) if SUPPORTED_KEYS.include?(key.to_s) instance_variable_get(:"@#{key}") else raise ArgumentError.new("invalid metric key specified: #{key}") end end end class MetricsEvent def initialize(metrics_event) @title = metrics_event['title'] @metrics = Metrics.new(metrics_event['metrics']) end attr_reader :title, :metrics end end
Version data entries
33 entries across 33 versions & 1 rubygems