Skip to content

Instantly share code, notes, and snippets.

@colinrubbert
Created June 13, 2015 17:26
Show Gist options
  • Save colinrubbert/bc7e8e8a648cf31d9821 to your computer and use it in GitHub Desktop.
Save colinrubbert/bc7e8e8a648cf31d9821 to your computer and use it in GitHub Desktop.
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