Sha256: f71f1e85c687206727635b63393dea7578ef8a666c98d044ba0728acc952efa7

Contents?: true

Size: 452 Bytes

Versions: 3

Compression:

Stored size: 452 Bytes

Contents

module HAR
  class PageTimings < SchemaType
    def initialize(input)
      super(input)
      @input = input
    end

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
har-0.1.5 lib/har/page_timings.rb
har-0.1.4 lib/har/page_timings.rb
har-0.1.3 lib/har/page_timings.rb