Class: Watobo::Interceptor::FilterChain

Inherits:
Object
  • Object
show all
Defined in:
lib/watobo/core/intercept_filter.rb

Instance Method Summary collapse

Constructor Details

#initializeFilterChain

Returns a new instance of FilterChain.


136
137
138
# File 'lib/watobo/core/intercept_filter.rb', line 136

def initialize
  @filters = []
end

Instance Method Details

#add_filter(filter) ⇒ Object


115
116
117
118
# File 'lib/watobo/core/intercept_filter.rb', line 115

def add_filter(filter)
  @filters << filter if filter.respond_to? :match?

end

#clearObject


132
133
134
# File 'lib/watobo/core/intercept_filter.rb', line 132

def clear
  @filters.clear
end

#listObject


128
129
130
# File 'lib/watobo/core/intercept_filter.rb', line 128

def list
  @filters
end

#match?(item, flags = nil) ⇒ Boolean

Returns:

  • (Boolean)

108
109
110
111
112
113
# File 'lib/watobo/core/intercept_filter.rb', line 108

def match?(item, flags=nil)
  @filters.each do |f|
    return false unless f.match?( item, flags )
  end
  true
end

#remove_filter(pos) ⇒ Object


120
121
122
# File 'lib/watobo/core/intercept_filter.rb', line 120

def remove_filter(pos)

end

#set_filters(filter) ⇒ Object


124
125
126
# File 'lib/watobo/core/intercept_filter.rb', line 124

def set_filters(filter)
  @filters = filter
end