kanrisuru 0.2.1 → 0.2.2

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: c85c69fa5f91368ab9857bfd7124a05516f3e3e6d224d2bd889a2334d93fe67f
4
- data.tar.gz: 43ead0d9b608199c14ee204c1f9dfc3910342138a8db211a2b7e62d3e6bad372
3
+ metadata.gz: dc638e7e85cf76460cffecc7bcd885a7cc3f30c098c1d2fa0250daeb455e87a2
4
+ data.tar.gz: 78d733e6299f3a49ce40a0be6bb73b50a8c6b9f184ceacf920bc55661653c393
5
5
  SHA512:
6
- metadata.gz: c95fa98ff75efa98e2faaea0656500f063b39721ba2535e3027581b1844571621b5d3ee9ad11787439d74dfedb80aee053ff8f32a7733c902a7535870921d7da
7
- data.tar.gz: 2ec71eec8b97ee92122d295bb5d736c9b44991cd134c4dce7c0b29e9e84462cb54997ece06d3ea5c8ca384d5221d4a9f4136223c60391888217f326f212343c1
6
+ metadata.gz: 2706ac5496f456560795adedbe445ecfa1509e7d3d60dde5b5d4e85a59687b1477fdf035aeba0b31a5ade24cc25c962a8cbb559a75ba5899eaf90e4f02ada212
7
+ data.tar.gz: 606de07f8ddd04465df2bc0f4bd3ffbfb1e362986613a31f2184076337ba9542ea05ac1874d36c24442d1609f176dfa1bd2cf8104835fa1233d9e4c68cd7f7a4
@@ -35,8 +35,8 @@ module Kanrisuru
35
35
  end
36
36
 
37
37
  def read_file_chunk(path, start_line, end_line)
38
- if start_line.instance_of?(Integer) || end_line.instance_of?(Integer) ||
39
- start_line > end_line || start_line.negative?
38
+ if !start_line.instance_of?(Integer) || !end_line.instance_of?(Integer) ||
39
+ start_line > end_line || start_line.negative? || end_line.negative?
40
40
  raise ArgumentError, 'Invalid start or end'
41
41
  end
42
42
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -74,6 +74,24 @@ RSpec.describe Kanrisuru::Core::Stream do
74
74
  expect(result.data).to eq(['a', 'file!'])
75
75
  end
76
76
 
77
+ it 'reads a chunk of text from a file' do
78
+ file = host.file("#{spec_dir}/test-file-chunk.txt")
79
+ file.touch
80
+ file.append do |f|
81
+ f << 'This'
82
+ f << 'is'
83
+ f << 'is'
84
+ f << 'a'
85
+ f << 'file'
86
+ f << 'forever...'
87
+ end
88
+
89
+ result = host.read_file_chunk("#{spec_dir}/test-file-chunk.txt", 2, 4)
90
+ expect(result).to be_success
91
+ expect(result.data.length).to eq(3)
92
+ expect(result.data).to eq(['is', 'is', 'a'])
93
+ end
94
+
77
95
  it 'cats a file' do
78
96
  result = host.cat('/etc/group')
79
97
  expect(result.success?).to eq(true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanrisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Mammina