Http_Error_Log 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,13 @@ require 'time'
5
5
  def Http_Error_Log file, skip = nil
6
6
  h = Http_Error_Log_Helper
7
7
  count = 0
8
+ skip = case skip
9
+ when Time, NilClass
10
+ skip
11
+ else
12
+ Time.parse skip
13
+ end
14
+
8
15
  lines = Split_Lines(File.read( file ))
9
16
  lines
10
17
  .map { |l|
@@ -14,7 +21,7 @@ def Http_Error_Log file, skip = nil
14
21
  prefix = pieces.shift
15
22
  time_str = prefix.split[0,2].join(' ')
16
23
 
17
- next if skip && Time.parse(time_str) <= Time.parse(skip)
24
+ next if skip && Time.parse(time_str) <= skip
18
25
 
19
26
  pieces.each_index { |i|
20
27
  if i.even?
@@ -1 +1 @@
1
- Http_Error_Log_VERSION = "0.1.1"
1
+ Http_Error_Log_VERSION = "0.1.2"
@@ -71,5 +71,11 @@ describe "Http_Error_Log :file, \"date time\"" do
71
71
  .should == target
72
72
  end
73
73
 
74
+ it "accepts a Time object instead of a String" do
75
+ target = NGINX_ERROR_LOG[1, NGINX_ERROR_LOG.size]
76
+ Http_Error_Log("spec/file/nginx.error.log", Time.parse("2012/01/01 01:01:01 "))
77
+ .should == target
78
+ end
79
+
74
80
  end # === Http_Error_Log :file, \"skip\"
75
81
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Http_Error_Log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: