class Fantasy::Event::Factory

Public Class Methods

new() click to toggle source
# File lib/fantasy-irc/events.rb, line 6
def initialize
    puts "Initializing new Event::Factory #{self}"
    @events = Hash.new
end

Public Instance Methods

by_name(name) click to toggle source
# File lib/fantasy-irc/events.rb, line 22
def by_name name
    name.downcase!

    if not @events[name] then
        raise "Tried to access unknown event \"#{name}\" in Event::Factory \"#{self}\""
    end

    @events[name]
end
create(name) click to toggle source
# File lib/fantasy-irc/events.rb, line 11
def create name
    name.downcase!

    if not @events[name].nil? then
        return @events[name]
        # TODO: log warning
    end

    @events[name] = Event.new(name)
end