class Prolefeed

Attributes

book_ends[R]
story[R]

Public Class Methods

new() click to toggle source
# File lib/prolefeed.rb, line 3
def initialize
  @book_ends = []
  @story = []
end

Public Instance Methods

add_to_bookends(string) click to toggle source
# File lib/prolefeed.rb, line 8
def add_to_bookends(string)
  self.book_ends << string
end
add_to_story(string) click to toggle source
# File lib/prolefeed.rb, line 12
def add_to_story(string)
  self.story << string
end
generate() click to toggle source
# File lib/prolefeed.rb, line 16
def generate
  generated_story = []
  shuffled_bookends = book_ends.shuffle
  shuffled_story = story.shuffle
  introduction = shuffled_bookends.pop unless shuffled_bookends.empty?
  conclusion = shuffled_bookends.pop unless shuffled_bookends.empty?
  shuffled_story.unshift(introduction).push(conclusion)
end