module Fish

Constants

VERSION

Public Class Methods

fish(len = 3, looks_right = true) click to toggle source
# File lib/Fish.rb, line 4
def self.fish(len = 3, looks_right = true)
    if looks_right
        "><#{'(' * len}°>"
    else
        "<°#{')' * len}><"
    end
end
is_fish?(str) click to toggle source
# File lib/Fish.rb, line 18
def self.is_fish?(str)
    ret = false
    ret = true if str.match(/><\(+°>/) != nil
    ret = true if str.match(/<°\)+></) != nil
    return ret
end
many_fish(num, len = 3, looks_right = true) click to toggle source
# File lib/Fish.rb, line 12
def self.many_fish(num, len = 3, looks_right = true)
    a = []
    num.times {a << fish(len, looks_right)}
    return a
end
many_random_fish(num, max_len = 10) click to toggle source
# File lib/Fish.rb, line 29
def self.many_random_fish(num, max_len = 10)
    a = []
    num.times {a << random_fish(max_len)}
    return a
end
random_fish(max_len = 10) click to toggle source
# File lib/Fish.rb, line 25
def self.random_fish(max_len = 10)
    fish(1 + rand(max_len), rand(2) == 1)
end