Class: Participle::DA::User

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

Overview

Represents a user connected to dAmn.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (User) initialize(nick, admin)

Returns a new instance of User

Parameters:

  • nick (String)

    the user name

  • admin (String)

    the bot admin name



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

def initialize nick, admin
  @nick   = nick
  @admin  = admin
end

Instance Attribute Details

- (String) nick (readonly)

Returns the user's name

Returns:

  • (String)

    the user's name



7
8
9
# File 'lib/user.rb', line 7

def nick
  @nick
end

Instance Method Details

- (Boolean) ===(nick)

Is the user's name nick?

Returns:

  • (Boolean)


28
29
30
# File 'lib/user.rb', line 28

def ===(nick)
  @nick == nick
end

- (Boolean) admin?

Returns whether the user is an administrator

Returns:

  • (Boolean)

    whether the user is an administrator



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

def admin?
  @nick == @admin
end

- (String) to_s

Returns:

  • (String)


22
23
24
# File 'lib/user.rb', line 22

def to_s
  "#<#@nick:DA::User>"
end