Sha256: c777215ce43680484b8905d96048f52f138a6b3d0f07cc6cbaaacdc1b0d225eb

Contents?: true

Size: 319 Bytes

Versions: 3

Compression:

Stored size: 319 Bytes

Contents

module AutoEmo
  class Poem
    File.open(File.join(File.dirname(__FILE__), 'poems')) do |f|
      @@poems = Marshal.load(f)
    end

    def self.generate
      length = 4 + rand(7)
      lines = []

      length.times do
        lines << @@poems[rand(@@poems.size)]
      end

      lines.join("\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
edward-auto-emo-0.1.0 lib/auto-emo.rb
edward-auto-emo-1.0.0 lib/auto-emo.rb
auto-emo-1.0.0 lib/auto-emo.rb