Class: MessageFilter::Filter::Filters
- Inherits:
-
Object
- Object
- MessageFilter::Filter::Filters
- Defined in:
- lib/message_filter/filter_methods.rb
Overview
filter instances
Instance Method Summary collapse
- #add(options) ⇒ Object
- #default_of(type) ⇒ Object
- #filters_of(type) ⇒ Object
-
#initialize ⇒ Filters
constructor
A new instance of Filters.
Constructor Details
#initialize ⇒ Filters
Returns a new instance of Filters.
30 31 32 |
# File 'lib/message_filter/filter_methods.rb', line 30 def initialize @filters = {} end |
Instance Method Details
#add(options) ⇒ Object
34 35 36 37 |
# File 'lib/message_filter/filter_methods.rb', line 34 def add() new_entry = FilterEntry.new() @filters[new_entry.handler] = new_entry end |
#default_of(type) ⇒ Object
47 48 49 50 51 |
# File 'lib/message_filter/filter_methods.rb', line 47 def default_of(type) @filters.each do |_key, filter| return filter.handler if filter.default? type end end |
#filters_of(type) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/message_filter/filter_methods.rb', line 39 def filters_of(type) handlers = [] @filters.each do |_key, filter| handlers.push filter if filter.has? type end handlers end |