Class: Irc::Bot::DataStream

Inherits:
Hash
  • Object
show all
Defined in:
/home/apoc/projects/ruby/rbot/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

- (DataStream) initialize(*args)

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 '/home/apoc/projects/ruby/rbot/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

- (Object) to_s

Returns the :text key



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

def to_s
  return self[:text]
end