chrislee_test_gem 0.0.3 → 0.0.4
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.
- data/bin/test_gem +2 -4
- data/lib/test_gem/myfile.rb +2 -2
- data/lib/test_gem/version.rb +1 -1
- metadata +1 -1
data/bin/test_gem
CHANGED
@@ -3,11 +3,9 @@ require 'test_gem'
|
|
3
3
|
|
4
4
|
case ARGV[0]
|
5
5
|
when "first"
|
6
|
-
|
7
|
-
puts first_line.first(ARGV[1])
|
6
|
+
puts TestGem::MyFile.first(ARGV[1])
|
8
7
|
when "last"
|
9
|
-
|
10
|
-
puts last_line.last(ARGV[1])
|
8
|
+
puts TestGem::MyFile.last(ARGV[1])
|
11
9
|
else
|
12
10
|
puts "test_gem can return the first or last line of a text file"
|
13
11
|
puts "Usage:"
|
data/lib/test_gem/myfile.rb
CHANGED
@@ -5,11 +5,11 @@ module TestGem
|
|
5
5
|
@file_location = file_location
|
6
6
|
end
|
7
7
|
|
8
|
-
def first file_location=@file_location
|
8
|
+
def self.first file_location=@file_location
|
9
9
|
File.open(file_location, "r"){|f| f.readlines[0].chomp}
|
10
10
|
end
|
11
11
|
|
12
|
-
def last file_location=@file_location
|
12
|
+
def self.last file_location=@file_location
|
13
13
|
File.open(file_location,"r"){|f| f.readlines.last.chomp}
|
14
14
|
end
|
15
15
|
|
data/lib/test_gem/version.rb
CHANGED