From 41e46ac67664f3bbec427d4e332a89783073e856 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 13 Mar 2008 08:40:09 +0100 Subject: filters: DataStream can now be initialized with a String followed by a Hash --- lib/rbot/core/utils/filters.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rbot/core/utils/filters.rb b/lib/rbot/core/utils/filters.rb index 5744b732..fbd20333 100644 --- a/lib/rbot/core/utils/filters.rb +++ b/lib/rbot/core/utils/filters.rb @@ -18,8 +18,15 @@ module ::Irc # converting to String class DataStream < Hash - def initialize(hsh={}) - self.replace(hsh) + # call-seq: new(text, hash) + # + # Create a new DataStream with text _text_ and attributes held by _hash_. + # Either parameter can be missing; if _text_ is missing, the text can be + # be defined in the _hash_ with a :text key. + # + def initialize(*args) + self.replace(args.pop) if Hash === args.last + self[:text] = args.first if args.length > 0 end # Returns the :text key -- cgit v1.2.3