Sha256: e31ee15f0bf73d46928bf8c3cf2d9ce8f2be151e4499bb2e33ccc3b448708664

Contents?: true

Size: 601 Bytes

Versions: 7

Compression:

Stored size: 601 Bytes

Contents

module Jschematic
  module Attributes
    module Format

      # Looks like HAR files have slightly non-compliant dates,
      # so we override DateTime#accepts? to also check for that
      class DateTime
        alias_method :accepts_orig?, :accepts?

        def accepts?(date_time)
          accepts_orig?(date_time) || accepts_har_date?(date_time)
        end

        def accepts_har_date?(date_time)
          # taken from harSchema.js
          date_time =~ /^(\d{4})(-)?(\d\d)(-)?(\d\d)(T)?(\d\d)(:)?(\d\d)(:)?(\d\d)(\.\d+)?(Z|([+-])(\d\d)(:)?(\d\d))/
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
har-0.1.5 lib/har/extensions/jschematic/attributes/format.rb
har-0.1.4 lib/har/extensions/jschematic/attributes/format.rb
har-0.1.3 lib/har/extensions/jschematic/attributes/format.rb
har-0.1.2 lib/har/extensions/jschematic/attributes/format.rb
har-0.1.1 lib/har/extensions/jschematic/attributes/format.rb
har-0.1.0 lib/har/extensions/jschematic/attributes/format.rb
har-0.0.9 lib/har/extensions/jschematic/attributes/format.rb