tailog 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -13
  2. data/lib/tailog/version.rb +1 -1
  3. data/lib/tailog.rb +3 -6
  4. metadata +9 -10
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OGY5OGFkMjMyZTRiY2IzYjI0YTYxNmNkNTFkMmY0OWM1ZjYxNGZiMw==
5
- data.tar.gz: !binary |-
6
- NzM5MTlhNzc0ZGZmZTljZTk1N2U5YWNjYWNmMTJiYzU5MTkxZTFhMg==
2
+ SHA1:
3
+ metadata.gz: 5e8266a49931997038e621a0eeaa66f5a5cc076c
4
+ data.tar.gz: 42785658973a4711691b530fa9975802c024bbda
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- M2U1YjAyNGY4ZjViMGNkNzBlOTY3NGFjMmZiMGExNDdjOWE1MTliNjZjZTlk
10
- MThiYWU4ZTBiYjdjY2Y0ZmUzZmJjN2ZjNTgyNDI2NzZjYjQzYTkyODNmODA4
11
- NjIyOWY3NmExYTE5ODkwNDVmNjRiYjdiMzgxY2FjMmFmOTYyYTA=
12
- data.tar.gz: !binary |-
13
- Y2JiNDE2ZTRlMDc5YjM5NjQwMDdiMzI5MWY1NWMwMWJmMTVmOTEzOTIyYTYx
14
- YWFjNzViNzAyYWFkMGVmNjg0ZTg3MzYxZGE1NzE2ODhkZjEzMjQ4Nzk5ZmQ1
15
- MmI2MTg3NjRhZGRiMzkyNjJjMTU0ZDI4MDk1MTA5YmVmNDBhMmQ=
6
+ metadata.gz: 0e8ee9397b06785966a2bf7e95e75c710924ff4e1abb44d46548fefefdd8568e9f14646d0593c74a82620a15e034946aaff4e2ed2c480a2f5c703607a2c415a8
7
+ data.tar.gz: 007d85c867c23903d005b032051647b4e219668a4000fe86edfa98070999df8d35ed842c26d3e8c986c6adb6687a98f304961d8a162f68e076e470a44119d0e4
@@ -1,3 +1,3 @@
1
1
  module Tailog
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/tailog.rb CHANGED
@@ -5,7 +5,7 @@ class File
5
5
 
6
6
  def tail(n)
7
7
  buffer = 1024
8
- idx = (size - buffer).abs
8
+ idx = size > buffer ? size - buffer : 0
9
9
  chunks = []
10
10
  lines = 0
11
11
 
@@ -16,12 +16,9 @@ class File
16
16
  lines += chunk.count("\n")
17
17
  chunks.unshift chunk
18
18
  idx -= buffer
19
- end while lines < ( n + 1 ) && pos != 0
20
-
21
- tail_of_file = chunks.join('')
22
- ary = tail_of_file.split(/\n/)
23
- lines_to_return = ary[ ary.size - n, ary.size - 1 ]
19
+ end while lines < ( n + 1 ) && idx >= 0
24
20
 
21
+ chunks.join('').split(/\n/).last(n)
25
22
  end
26
23
  end
27
24
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bbtfr
@@ -14,28 +14,28 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  description: Sinatra App to serve log in browser
@@ -45,7 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
48
+ - ".gitignore"
49
49
  - CODE_OF_CONDUCT.md
50
50
  - Gemfile
51
51
  - README.md
@@ -67,19 +67,18 @@ require_paths:
67
67
  - lib
68
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - ! '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '0'
73
73
  required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - ! '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.8
80
+ rubygems_version: 2.4.6
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: tail -f to the web-browser
84
84
  test_files: []
85
- has_rdoc: