From 847a977b228b35f5ab281a31dd3724a4db887dff Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 23 Jun 2008 01:17:52 +0200 Subject: #any? and #all? methods for Channel#mode to check if modes are set --- lib/rbot/irc.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3