har 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/lib/har/archive.rb +8 -0
- data/lib/har/page.rb +1 -1
- data/lib/har/version.rb +1 -1
- data/spec/har/archive_spec.rb +17 -0
- data/spec/har/page_spec.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc8dfbd201bca881b71c071836f222f87e341d434b8bf5bbc406601a2e18a565
|
4
|
+
data.tar.gz: 904b1ad8e28736f315e3e65a3f05625f9ae247d8f5ab1a5113897205421269ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c43b9a86d441aea80c00c067a7c6b3b95966ad01cdb96d192c0ed841a533afc91296381ee2e654357bf314e9e82b734834f58f30ddb4f18d6cd108a1f69abda1
|
7
|
+
data.tar.gz: 19452bbbb8eee514e235f7701f2ac2e35d4a27a7086f22827499dc42c4aec4e7072cddd0673ab14d4b48c86a723517594ed4152c1cd3e969934ebf7d1c0d9369
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/lib/har/archive.rb
CHANGED
@@ -72,6 +72,14 @@ module HAR
|
|
72
72
|
@entries ||= raw_entries.map { |e| Entry.new(e) }
|
73
73
|
end
|
74
74
|
|
75
|
+
def entries_before(time)
|
76
|
+
raise TypeError, "expected Time" unless time.is_a?(Time)
|
77
|
+
entries.select do |entry|
|
78
|
+
return false unless entry.time
|
79
|
+
entry.started_date_time + entry.time / 1000.0 <= time
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
75
83
|
# create a new archive by merging this and another archive
|
76
84
|
|
77
85
|
def merge(other)
|
data/lib/har/page.rb
CHANGED
@@ -16,7 +16,7 @@ module HAR
|
|
16
16
|
raise TypeError, "expected Time" unless time.is_a?(Time)
|
17
17
|
entries.select do |entry|
|
18
18
|
return false unless entry.time
|
19
|
-
entry.started_date_time + entry.time / 1000.0
|
19
|
+
entry.started_date_time + entry.time / 1000.0 <= time
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/lib/har/version.rb
CHANGED
data/spec/har/archive_spec.rb
CHANGED
@@ -152,5 +152,22 @@ module HAR
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
describe "#entries_before" do
|
156
|
+
let(:archive) { Archive.from_file(google_path) }
|
157
|
+
|
158
|
+
it "requires a DateTime" do
|
159
|
+
expect { archive.entries_before("a string") }.to raise_error(TypeError)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "filters entries that responded before the specified time" do
|
163
|
+
time = archive.pages.first.started_date_time + 0.250
|
164
|
+
entries = archive.entries_before(time)
|
165
|
+
entries.each do |entry|
|
166
|
+
(entry.started_date_time + entry.time / 1000.to_f).should < time
|
167
|
+
end
|
168
|
+
|
169
|
+
entries.length.should < archive.entries.length
|
170
|
+
end
|
171
|
+
end
|
155
172
|
end # Archive
|
156
173
|
end # HAR
|
data/spec/har/page_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: har
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -118,6 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- ".gitignore"
|
120
120
|
- ".rspec"
|
121
|
+
- ".ruby-version"
|
121
122
|
- ".travis.yml"
|
122
123
|
- Gemfile
|
123
124
|
- LICENSE
|