Module: Simnos::Filterable

Included in:
Client, ClientWrapper
Defined in:
lib/simnos/filterable.rb

Instance Method Summary collapse

Instance Method Details

#target?(topic_name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simnos/filterable.rb', line 3

def target?(topic_name)
  unless @options[:includes].empty?
    unless @options[:includes].include?(topic_name)
      Simnos.logger.debug("skip topic(with include-names option) #{topic_name}")
      return false
    end
  end

  unless @options[:excludes].empty?
    if @options[:excludes].any? { |regex| topic_name =~ regex }
      Simnos.logger.debug("skip topic(with exclude-names option) #{topic_name}")
      return false
    end
  end
  true
end