jsfrost_test_gem 0.0.1 → 0.0.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.
- data/bin/test_gem +18 -1
- data/lib/test_gem/file.rb +27 -0
- data/lib/test_gem/version.rb +2 -2
- data/lib/test_gem.rb +2 -1
- metadata +2 -1
data/bin/test_gem
CHANGED
@@ -1,4 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require 'test_gem'
|
4
|
+
|
3
5
|
puts "test_gem script executing"
|
4
|
-
puts ARGV[0]
|
6
|
+
puts ARGV[0]
|
7
|
+
|
8
|
+
print "Working with file: "
|
9
|
+
puts ARGV[0]
|
10
|
+
|
11
|
+
returnVal = TestGem::File.first ARGV[0]
|
12
|
+
|
13
|
+
print "The chomped first line of that file is: "
|
14
|
+
puts returnVal
|
15
|
+
|
16
|
+
returnVal2 = TestGem::File.last ARGV[0]
|
17
|
+
|
18
|
+
print "The chomped last line of that file is: "
|
19
|
+
puts returnVal2
|
20
|
+
|
21
|
+
puts "Bye bye, from test_gem"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module TestGem
|
2
|
+
|
3
|
+
class File
|
4
|
+
puts "class #{self} defined"
|
5
|
+
|
6
|
+
def File.first fileName
|
7
|
+
results = []
|
8
|
+
open(fileName).each do |line|
|
9
|
+
results << line
|
10
|
+
end
|
11
|
+
p "The file has #{results.size} lines."
|
12
|
+
p "The first line is: #{results.first}."
|
13
|
+
results.first.chomp
|
14
|
+
end
|
15
|
+
|
16
|
+
def File.last fileName
|
17
|
+
results = []
|
18
|
+
open(fileName).each do |line|
|
19
|
+
results << line
|
20
|
+
end
|
21
|
+
p "The file has #{results.size} lines."
|
22
|
+
p "The last line is: #{results.last}."
|
23
|
+
results.last.chomp
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/test_gem/version.rb
CHANGED
data/lib/test_gem.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsfrost_test_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- lib/test_gem.rb
|
22
22
|
- lib/test_gem/version.rb
|
23
23
|
- lib/test_gem/hello.rb
|
24
|
+
- lib/test_gem/file.rb
|
24
25
|
- !binary |-
|
25
26
|
YmluL3Rlc3RfZ2Vt
|
26
27
|
homepage: http://rubygems.org/gems/test_gem
|