Class: Irc::Bot::DataFilter

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

Overview

The DataFilter class. A DataFilter is a wrapper around a block that can be run on a DataStream to process it. The block is supposed to return another DataStream object

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ DataFilter

Returns a new instance of DataFilter.



40
41
42
43
# File 'lib/rbot/core/utils/filters.rb', line 40

def initialize(&block)
  raise "No block provided" unless block_given?
  @block = block
end

Instance Method Details

#call(stream) ⇒ Object Also known as: run, filter



45
46
47
# File 'lib/rbot/core/utils/filters.rb', line 45

def call(stream)
  @block.call(stream)
end