Class: IRC_message

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

Instance Method Summary collapse

Constructor Details

#initialize(command, nick, channel, message, ircmsg) ⇒ IRC_message

Returns a new instance of IRC_message.



15
16
17
18
19
20
21
# File 'lib/rirc.rb', line 15

def initialize(command, nick, channel, message, ircmsg)
	@command = command
	@nick = nick
	@channel = channel
	@message = message
	@ircmsg = ircmsg
end

Instance Method Details

#channelObject



39
40
41
# File 'lib/rirc.rb', line 39

def channel
	return @channel
end

#check_regex(type, regex) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rirc.rb', line 43

def check_regex(type, regex)

	if type == "command"
		if @command.match(regex) then return true end
	elsif type == "nick"
		if @nick.match(regex) then return true end
	elsif type == "channel"
		if @channel.match(regex) then return true end
	elsif type == "message"
		if @message.match(regex) then return true end
	else
		if @message.match(regex) then return true end
	end

	return false
end

#commandObject



35
36
37
# File 'lib/rirc.rb', line 35

def command
	return @command
end

#ircmsgObject



23
24
25
# File 'lib/rirc.rb', line 23

def ircmsg
	return @ircmsg
end

#messageObject



27
28
29
# File 'lib/rirc.rb', line 27

def message
	return @message
end

#message_regex(regex) ⇒ Object



60
61
62
63
64
# File 'lib/rirc.rb', line 60

def message_regex(regex)
	if @message.match(regex) then return true end

	return false
end

#nickObject



31
32
33
# File 'lib/rirc.rb', line 31

def nick
	return @nick
end