Class: Irc::Bot::DataStream

Inherits:
Hash
  • Object
show all
Defined in:
lib/rbot/core/utils/filters.rb

Overview

The DataStream class. A DataStream is just a Hash. The :text key has a special meaning because it’s the value that will be used when converting to String

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ DataStream

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.



25
26
27
28
# File 'lib/rbot/core/utils/filters.rb', line 25

def initialize(*args)
  self.replace(args.pop) if Hash === args.last
  self[:text] = args.first if args.length > 0
end

Instance Method Details

#to_sObject

Returns the :text key



31
32
33
# File 'lib/rbot/core/utils/filters.rb', line 31

def to_s
  return self[:text]
end