Sha256: 5ae5a78941e1b38a4760fa6d05885f75b3ff9fc9d10ba90cc7ffcca990185a7c
Contents?: true
Size: 456 Bytes
Versions: 4
Compression:
Stored size: 456 Bytes
Contents
require 'cowsay/version' require 'cowsay/character' module ::Cowsay module_function # all instance methods are available on the module (class) level def random_character random_class = Character.const_get(character_classes[rand(character_classes.length)]) random_class.new end def character_classes @character_classes ||= Character.constants - [:Base, :Template] end def say(message) random_character.say(message) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cowsay-0.1.0 | lib/cowsay.rb |
cowsay-0.0.5 | lib/cowsay.rb |
cowsay-0.0.4 | lib/cowsay.rb |
cowsay-0.0.3 | lib/cowsay.rb |