summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-13 08:40:09 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-03-13 08:40:09 +0100
commit41e46ac67664f3bbec427d4e332a89783073e856 (patch)
treec17606ade2d3ad247f160ca735ebc39a77d84f8d /lib/rbot
parent954344576db4a5b60c6bae1fa13eaa2946e427a8 (diff)
filters: DataStream can now be initialized with a String followed by a Hash
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/core/utils/filters.rb11
1 files 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