Class: Eg::Book::Room

Inherits:
Object
  • Object
show all
Defined in:
lib/eg/book/chat_server_actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(room_name, owner, chat) ⇒ Room

Returns a new instance of Room.



70
71
72
73
74
75
# File 'lib/eg/book/chat_server_actions.rb', line 70

def initialize room_name, owner, chat
  @name = room_name
  @owner = owner
  @chat = chat
  @users = Set.new
end

Instance Method Details

#add(user) ⇒ Object



76
77
78
# File 'lib/eg/book/chat_server_actions.rb', line 76

def add user
  @users.add user
end

#occupant_countObject



79
80
81
# File 'lib/eg/book/chat_server_actions.rb', line 79

def occupant_count
  @users.size
end