Class: HAR::PageTimings

Inherits:
SchemaType show all
Defined in:
lib/har/page_timings.rb

Instance Method Summary collapse

Methods included from Serializable

#==, #as_json, #inspect, #to_json

Constructor Details

#initialize(input) ⇒ PageTimings

Returns a new instance of PageTimings.



3
4
5
6
# File 'lib/har/page_timings.rb', line 3

def initialize(input)
  super(input)
  @input = input
end

Instance Method Details

#customObject



8
9
10
11
12
13
14
15
16
# File 'lib/har/page_timings.rb', line 8

def custom
  @custom ||= begin
    # TODO: move to `transform_keys` once ruby 2.0.0 support is dropped
    custom_timings = Hash[@input.select { |key| key.start_with?('_') }
                                .map { |key, val| [key[1..-1], val] }]

    OpenStruct.new(custom_timings)
  end
end