Class: Watobo::Interceptor::FilterChain
- Inherits:
-
Object
- Object
- Watobo::Interceptor::FilterChain
- Defined in:
- lib/watobo/core/intercept_filter.rb
Instance Method Summary collapse
- #add_filter(filter) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ FilterChain
constructor
A new instance of FilterChain.
- #list ⇒ Object
- #match?(item, flags = nil) ⇒ Boolean
- #remove_filter(pos) ⇒ Object
- #set_filters(filter) ⇒ Object
Constructor Details
#initialize ⇒ FilterChain
Returns a new instance of FilterChain.
115 116 117 |
# File 'lib/watobo/core/intercept_filter.rb', line 115 def initialize @filters = [] end |
Instance Method Details
#add_filter(filter) ⇒ Object
94 95 96 97 |
# File 'lib/watobo/core/intercept_filter.rb', line 94 def add_filter(filter) @filters << filter if filter.respond_to? :match? end |
#clear ⇒ Object
111 112 113 |
# File 'lib/watobo/core/intercept_filter.rb', line 111 def clear @filters.clear end |
#list ⇒ Object
107 108 109 |
# File 'lib/watobo/core/intercept_filter.rb', line 107 def list @filters end |
#match?(item, flags = nil) ⇒ Boolean
87 88 89 90 91 92 |
# File 'lib/watobo/core/intercept_filter.rb', line 87 def match?(item, flags=nil) @filters.each do |f| return false unless f.match?( item, flags ) end true end |
#remove_filter(pos) ⇒ Object
99 100 101 |
# File 'lib/watobo/core/intercept_filter.rb', line 99 def remove_filter(pos) end |
#set_filters(filter) ⇒ Object
103 104 105 |
# File 'lib/watobo/core/intercept_filter.rb', line 103 def set_filters(filter) @filters = filter end |