Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Tarnoff committed Aug 26, 2013
0 parents commit 68ca083
Show file tree
Hide file tree
Showing 2 changed files with 10,029 additions and 0 deletions.
42 changes: 42 additions & 0 deletions haiku.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#Dependancies
require 'csv'
#Class
class Haiku
$file
$poem
def initialize
puts "Making a haiku"
filename = "words.csv"
$file = CSV.read(filename)
puts make_poem
end

def build_line(size)
$i = 0
$num = size
$line = ''
while $i < $num do
$line += fetch_random_word
puts $line
$i += 1
end
end

def make_poem
$poem = build_line(5).to_s
$poem = build_line(7).to_s
$poem = build_line(5).to_s
return $poem
end

# def self.parse_line(line, options = Hash.new)
# new(line, options).shift
# end

def fetch_random_word
wordRow = 1 + rand(10000)
return $file[wordRow].to_s
end
end

haiku = Haiku.new
Loading

0 comments on commit 68ca083

Please sign in to comment.