Class: Hector::UserSession
- Defined in:
- lib/hector/user_session.rb
Constant Summary
Constants inherited from Session
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#realname ⇒ Object
readonly
Returns the value of attribute realname.
Attributes inherited from Session
#away_message, #nickname, #request, #response
Class Method Summary collapse
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(nickname, connection, identity, realname) ⇒ UserSession
constructor
A new instance of UserSession.
- #respond_with ⇒ Object
- #username ⇒ Object
Methods inherited from Session
all, #away, #away?, #back, #broadcast, broadcast_to, #channel?, delete, #deliver, find, #find, #hostname, #name, nicknames, normalize, #receive, register, rename, #rename, reset!, #source, #who
Methods included from Commands::Invite
Methods included from Commands::Away
Methods included from Commands::Whois
#on_whois, #respond_to_whois_for, #whois
Methods included from Commands::Who
#on_who, #sessions_for_who, #who
Methods included from Commands::Topic
Methods included from Commands::Realname
Methods included from Commands::Quit
Methods included from Commands::Privmsg
Methods included from Commands::Pong
Methods included from Commands::Ping
Methods included from Commands::Part
Methods included from Commands::Notice
Methods included from Commands::Nick
Methods included from Commands::Names
Methods included from Commands::Mode
Methods included from Commands::Join
Methods included from Concerns::Presence
#channels, #destroy_presence, included, #initialize_presence, #peer_sessions, #seconds_idle, #touch_presence
Methods included from Concerns::KeepAlive
#destroy_keep_alive, #initialize_keep_alive, #on_heartbeat
Constructor Details
#initialize(nickname, connection, identity, realname) ⇒ UserSession
Returns a new instance of UserSession.
15 16 17 18 19 20 21 22 |
# File 'lib/hector/user_session.rb', line 15 def initialize(nickname, connection, identity, realname) super(nickname) @connection = connection @identity = identity @realname = realname initialize_keep_alive initialize_presence end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/hector/user_session.rb', line 3 def connection @connection end |
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
3 4 5 |
# File 'lib/hector/user_session.rb', line 3 def identity @identity end |
#realname ⇒ Object (readonly)
Returns the value of attribute realname.
3 4 5 |
# File 'lib/hector/user_session.rb', line 3 def realname @realname end |
Class Method Details
.create(nickname, connection, identity, realname) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/hector/user_session.rb', line 6 def create(nickname, connection, identity, realname) if find(nickname) raise NicknameInUse, nickname else register UserSession.new(nickname, connection, identity, realname) end end |
Instance Method Details
#destroy ⇒ Object
24 25 26 27 28 |
# File 'lib/hector/user_session.rb', line 24 def destroy super destroy_presence destroy_keep_alive end |
#respond_with ⇒ Object
30 31 32 |
# File 'lib/hector/user_session.rb', line 30 def respond_with(*) connection.respond_with(super) end |
#username ⇒ Object
34 35 36 |
# File 'lib/hector/user_session.rb', line 34 def username identity.username end |