Class: Sponge::IRC::User

Inherits:
Object
  • Object
show all
Defined in:
lib/sponge/irc/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, nick, user, host) ⇒ User

Returns a new instance of User.



17
18
19
20
21
22
# File 'lib/sponge/irc/user.rb', line 17

def initialize(client, nick, user, host)
  @client = client
  @nick = nick
  @user = user
  @host = host
end

Instance Attribute Details

#clientObject (readonly)

Our IRC::Client



6
7
8
# File 'lib/sponge/irc/user.rb', line 6

def client
  @client
end

#hostObject (readonly)

The hostname of this User



15
16
17
# File 'lib/sponge/irc/user.rb', line 15

def host
  @host
end

#nickObject (readonly)

The nickname of this User



9
10
11
# File 'lib/sponge/irc/user.rb', line 9

def nick
  @nick
end

#userObject (readonly)

The username of this User



12
13
14
# File 'lib/sponge/irc/user.rb', line 12

def user
  @user
end

Instance Method Details

#me?Boolean

Check if the User is us

Returns:

  • (Boolean)


25
26
27
# File 'lib/sponge/irc/user.rb', line 25

def me?
  client.config.nickname == nick
end

#to_sObject



29
30
31
# File 'lib/sponge/irc/user.rb', line 29

def to_s
  @nick
end