diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 08:40:09 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-03-13 08:40:09 +0100 |
commit | 41e46ac67664f3bbec427d4e332a89783073e856 (patch) | |
tree | c17606ade2d3ad247f160ca735ebc39a77d84f8d | |
parent | 954344576db4a5b60c6bae1fa13eaa2946e427a8 (diff) |
filters: DataStream can now be initialized with a String followed by a Hash
-rw-r--r-- | lib/rbot/core/utils/filters.rb | 11 |
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 |