summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-23 01:17:52 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-23 01:17:52 +0200
commit847a977b228b35f5ab281a31dd3724a4db887dff (patch)
tree3e7408b22261efa14cc7a21aaae7e4521106b877 /lib/rbot
parent2897490901dd623fb5b8683971222502ada357dc (diff)
#any? and #all? methods for Channel#mode to check if modes are set
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/irc.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb
index 31d432fd..72579b19 100644
--- a/lib/rbot/irc.rb
+++ b/lib/rbot/irc.rb
@@ -1358,6 +1358,14 @@ module Irc
# Flags
@mode = {}
+ class << @mode
+ def any?(*ar)
+ !!ar.find { |m| s = m.to_sym ; self[s] && self[s].set? }
+ end
+ def all?(*ar)
+ !ar.find { |m| s = m.to_sym ; !(self[s] && self[s].set?) }
+ end
+ end
end
# Removes a user from the channel