Class: Noyes::Filter

Inherits:
Object
  • Object
show all
Includes:
NoyesFilterDSL
Defined in:
lib/ruby_impl/filter.rb,
lib/common/noyes_dsl.rb

Overview

A generic filter. Just supply an array of weights.

Instance Method Summary (collapse)

Methods included from NoyesFilterDSL

#+, #|

Constructor Details

- (Filter) initialize(weights)

Returns a new instance of Filter



4
5
6
# File 'lib/ruby_impl/filter.rb', line 4

def initialize weights
  @weights = weights
end

Instance Method Details

- (Object) <<(data)



7
8
9
# File 'lib/ruby_impl/filter.rb', line 7

def << data
  data.zip(@weights).map {|d, h| d*h}
end