Class: Flamethrower::Irc::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ User

Returns a new instance of User.



8
9
10
11
12
13
14
15
# File 'lib/flamethrower/irc/user.rb', line 8

def initialize(options={})
  @username = options[:username]
  @nickname = options[:nickname]
  @hostname = options[:hostname]
  @realname = options[:realname]
  @servername = options[:servername]
  @modes = ["i"]
end

Instance Attribute Details

#away_messageObject

Returns the value of attribute away_message.



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

def away_message
  @away_message
end

#hostnameObject

Returns the value of attribute hostname.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def hostname
  @hostname
end

#modesObject

Returns the value of attribute modes.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def modes
  @modes
end

#nicknameObject

Returns the value of attribute nickname.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def nickname
  @nickname
end

#realnameObject

Returns the value of attribute realname.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def realname
  @realname
end

#servernameObject

Returns the value of attribute servername.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def servername
  @servername
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/flamethrower/irc/user.rb', line 5

def username
  @username
end

Instance Method Details

#modeObject



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

def mode
  "+#{@modes.join}"
end

#nick_set?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/flamethrower/irc/user.rb', line 17

def nick_set?
  !!@nickname
end

#to_sObject



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

def to_s
  "#{@nickname}!#{@username}@#{@hostname}"
end

#user_set?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/flamethrower/irc/user.rb', line 21

def user_set?
  !!@username && !!@hostname && !!@realname && !!@servername
end