diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-06-23 01:17:52 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-06-23 01:17:52 +0200 |
commit | 847a977b228b35f5ab281a31dd3724a4db887dff (patch) | |
tree | 3e7408b22261efa14cc7a21aaae7e4521106b877 /lib | |
parent | 2897490901dd623fb5b8683971222502ada357dc (diff) |
#any? and #all? methods for Channel#mode to check if modes are set
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/irc.rb | 8 |
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 |