Class: Fantasy::Room::Factory
- Inherits:
-
Object
- Object
- Fantasy::Room::Factory
- Defined in:
- lib/fantasy-irc/rooms.rb
Instance Method Summary collapse
- #all ⇒ Object
- #by_name(name) ⇒ Object
-
#initialize(connection) ⇒ Factory
constructor
A new instance of Factory.
- #new(name) ⇒ Object (also: #create)
Constructor Details
#initialize(connection) ⇒ Factory
Returns a new instance of Factory.
4 5 6 7 8 |
# File 'lib/fantasy-irc/rooms.rb', line 4 def initialize connection puts "Initializing new Room::Factory #{self} with connection #{connection}" @data, @data[:rooms] = Hash.new, Hash.new @connection = connection end |
Instance Method Details
#all ⇒ Object
33 34 35 |
# File 'lib/fantasy-irc/rooms.rb', line 33 def all @data[:rooms] end |
#by_name(name) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fantasy-irc/rooms.rb', line 22 def by_name name name.downcase! if not @data[:rooms][name] then raise "Tried to access unknown room \"#{name}\" in Room::Factory \"#{self}\"" #TODO: log end @data[:rooms][name] end |