Module: Kashi::Filterable

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

Instance Method Summary collapse

Instance Method Details

#target?(website_name) ⇒ Boolean

Returns:

  • (Boolean)


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

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

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