Created
June 13, 2015 17:26
-
-
Save colinrubbert/bc7e8e8a648cf31d9821 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Madlib | |
attr_accessor(:sen, :adj) | |
def initialize | |
@sen | |
@adj | |
end | |
# Used to test that the arrays are functional | |
def output_madlib | |
puts "#{self.sen} #{self.adj}." | |
end | |
def sample_madlib | |
puts "#{self.sen.sample } #{self.adj.sample}." | |
end | |
def build_sentence | |
@sen = [] | |
@sen << "The fox is" | |
@sen << "The octopus is" | |
@sen << "The sky is" | |
@sen << "The emperor is" | |
@sen << "The man's face is" | |
@adj = [] | |
@adj << "orange" | |
@adj << "blue" | |
@adj << "green" | |
@adj << "cool" | |
@adj << "brilliant" | |
end | |
end | |
madlib = Madlib.new | |
madlib.build_sentence | |
madlib.sample_madlib |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment