Class: FilterChain::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/filter_chain/filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Filter

Returns a new instance of Filter.



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

def initialize(opts = {})
  @opts = opts
  on_initialize
end

Instance Attribute Details

#next_filterObject

Returns the value of attribute next_filter.



5
6
7
# File 'lib/filter_chain/filter.rb', line 5

def next_filter
  @next_filter
end

#optsObject (readonly)

Returns the value of attribute opts.



3
4
5
# File 'lib/filter_chain/filter.rb', line 3

def opts
  @opts
end

Instance Method Details

#input(data) ⇒ Object



12
13
14
15
16
# File 'lib/filter_chain/filter.rb', line 12

def input(data)
  on_input(data)
  
  nil
end

#pass(data) ⇒ Object

Raises:



18
19
20
21
22
# File 'lib/filter_chain/filter.rb', line 18

def pass(data)
  raise NextFilterMissing unless next_filter
  
  next_filter.input(data)
end