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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc5b86787cdd8bd084aa569e18c3cbb4c51d844dbe8a0aae0b57a4b134bacbdd
4
- data.tar.gz: b355c64418e8be8b4a124af5589c53ca54c1b3b152fd2204b690dab2b0e0d14c
3
+ metadata.gz: bc8dfbd201bca881b71c071836f222f87e341d434b8bf5bbc406601a2e18a565
4
+ data.tar.gz: 904b1ad8e28736f315e3e65a3f05625f9ae247d8f5ab1a5113897205421269ab
5
5
  SHA512:
6
- metadata.gz: 9eefcce23f82109f605cfe4cf06b6b342ac00bc93ef1d4aca5af6ef17af04ce2d2129c07bf8efbb92946998d0fb5b9708eda9dcd796527068ad1aaf7917ff575
7
- data.tar.gz: c34a871b539e71343761555b66f4ea352b52366f0786334959506810642908eb6c23211f1d01f8dbadb4ffa8b5b78f2b38b6b0adbb559536e3accb132442f0b9
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 < time
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
@@ -1,3 +1,3 @@
1
1
  module HAR
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -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
@@ -30,6 +30,8 @@ module HAR
30
30
  entries.each do |entry|
31
31
  (entry.started_date_time + entry.time / 1000.to_f).should < time
32
32
  end
33
+
34
+ entries.length.should < page.entries.length
33
35
  end
34
36
  end
35
37
  end
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.3
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-08 00:00:00.000000000 Z
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