rack-logs 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 38f658a84c8b8956be836e3812a3a8362ee03f7d
4
- data.tar.gz: c0e31cdcd0de005e773eb4aeaa00f6eb276f0e44
3
+ metadata.gz: e9fef0a4a7ba691f8d17d6cff1fd00791d5f2a05
4
+ data.tar.gz: 9971a3879493d5e614798680b7b65eb7979ac030
5
5
  SHA512:
6
- metadata.gz: 7a952da98a94f7af5c0a2fd66483d60d0684e33d9c3bef6519c96eba97749afaa9b11b6824aa8fba194358f864d774db0b8dbcee261af6fc35afaf1374df47e9
7
- data.tar.gz: 72b85e5be9e67ebd24e42b44726886236721816b46e7e0073992d1339ff9452b3fd5dacd8ddc1fff14b0656494c471b64adc7ac5f540ec7690778c6caba06afe
6
+ metadata.gz: 1b89edfd6fcc0093668ee4430f896cf36990f35a2c809b87b1e9f537a1c691cd2cbdce7db9bbf1fd2240b8730b31ae7add8f1e2c740ee6d9857a2935676f291a
7
+ data.tar.gz: 791b88904009d3ed8340a737931019ae065fd9cca697b588389a88fb1b1ee94153e912e2ac340fc20f1a40e1eb4207cbbc7f582a2b6394d13e5759e33fc66bb7
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Logs
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -53,6 +53,25 @@ module Rack
53
53
  end
54
54
  end
55
55
  end
56
+
57
+ private
58
+
59
+ def tail file, n
60
+ index = 1
61
+ lines = 0
62
+ buffer = ""
63
+
64
+ begin
65
+ file.seek(index * (1024 * -1), :END)
66
+ chunk = file.read(1024)
67
+ lines += chunk.count("\n")
68
+ buffer.prepend chunk
69
+ index += 1
70
+ end while lines < n && file.pos >= 0
71
+
72
+ buffer.lines[-1 * n].join
73
+ end
74
+
56
75
  end
57
76
 
58
77
  def joined_logs path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-05 00:00:00.000000000 Z
11
+ date: 2014-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack