Class: Fantasy::User::User
- Inherits:
-
Object
- Object
- Fantasy::User::User
- Defined in:
- lib/fantasy-irc/users.rb
Instance Attribute Summary collapse
-
#mask ⇒ Object
readonly
Returns the value of attribute mask.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rooms ⇒ Object
Returns the value of attribute rooms.
Instance Method Summary collapse
-
#ignore! ⇒ Object
Ignoring.
- #ignored? ⇒ Boolean
-
#initialize(name, connection) ⇒ User
constructor
A new instance of User.
- #login ⇒ Object
-
#reset ⇒ Object
resets user information.
- #say(message) ⇒ Object
-
#to_s ⇒ Object
.
- #unignore! ⇒ Object
Constructor Details
#initialize(name, connection) ⇒ User
Returns a new instance of User.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fantasy-irc/users.rb', line 40 def initialize name, connection if not connection.respond_to?(:send) then raise "Connection class needs to be able to respond to :send" end @name = name puts "New User #{self.object_id} with name #{@name}" @connection = connection @rooms = Array::Unique.new end |
Instance Attribute Details
#mask ⇒ Object (readonly)
Returns the value of attribute mask.
37 38 39 |
# File 'lib/fantasy-irc/users.rb', line 37 def mask @mask end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/fantasy-irc/users.rb', line 37 def name @name end |
#rooms ⇒ Object
Returns the value of attribute rooms.
38 39 40 |
# File 'lib/fantasy-irc/users.rb', line 38 def rooms @rooms end |
Instance Method Details
#ignore! ⇒ Object
Ignoring
68 69 70 |
# File 'lib/fantasy-irc/users.rb', line 68 def ignore! @ignored = true end |
#ignored? ⇒ Boolean
76 77 78 |
# File 'lib/fantasy-irc/users.rb', line 76 def ignored? !!@ignored end |
#login ⇒ Object
62 63 64 |
# File 'lib/fantasy-irc/users.rb', line 62 def login self.name end |
#reset ⇒ Object
resets user information
52 53 54 55 |
# File 'lib/fantasy-irc/users.rb', line 52 def reset puts "Resetting user #{self.object_id} with name #{@name}" @rooms = Array::Unique.new end |
#say(message) ⇒ Object
57 58 59 60 |
# File 'lib/fantasy-irc/users.rb', line 57 def say @connection.send('PRIVMSG '+@name+' :'+) return self end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/fantasy-irc/users.rb', line 81 def to_s "#{@name}" end |
#unignore! ⇒ Object
72 73 74 |
# File 'lib/fantasy-irc/users.rb', line 72 def unignore! @ignored = false end |