Class: Weechat::IRC::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ User

Returns a new instance of User.



9
10
11
12
13
# File 'lib/weechat/user.rb', line 9

def initialize(args = {})
  @name = args[:name]
  @host = IRC::Host.new(args[:host])
  @flags, @color, @channel = args.values_at(:flags, :color, :channel)
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



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

def channel
  @channel
end

#colorObject (readonly)

Returns the value of attribute color.



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

def color
  @color
end

#flagsObject (readonly)

Returns the value of attribute flags.



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

def flags
  @flags
end

#hostObject (readonly)

Returns the value of attribute host.



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

def host
  @host
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/weechat/user.rb', line 4

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



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

def ==(other)
  @name == other.name && @host == other.host && @channel == other.channel
end

#banObject



56
57
58
# File 'lib/weechat/user.rb', line 56

def ban
  @channel.exec("/ban #@name")
end

#dehalfopObject



44
45
46
# File 'lib/weechat/user.rb', line 44

def dehalfop
  @channel.exec("/dehalfop #@name")
end

#deopObject



40
41
42
# File 'lib/weechat/user.rb', line 40

def deop
  @channel.exec("/deop #@name")
end

#devoiceObject



48
49
50
# File 'lib/weechat/user.rb', line 48

def devoice
  @channel.exec("/devoice #@name")
end

#halfopObject



32
33
34
# File 'lib/weechat/user.rb', line 32

def halfop
  @channel.exec("/halfop #@name")
end

#kick(reason = "") ⇒ Object



52
53
54
# File 'lib/weechat/user.rb', line 52

def kick(reason="")
  @channel.exec("/kick #@name #{reason}")
end

#kickban(reason = "") ⇒ Object



64
65
66
67
# File 'lib/weechat/user.rb', line 64

def kickban(reason="")
  kick(reason)
  ban
end

#opObject



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

def op
  @channel.exec("/op #@name")
end

#unbanObject



60
61
62
# File 'lib/weechat/user.rb', line 60

def unban
  @channel.exec("/unban #@name")
end

#voiceObject



36
37
38
# File 'lib/weechat/user.rb', line 36

def voice
  @channel.exec("/voice #@name")
end