Module: Roadworker::Utils::Helper

Included in:
Client, DSL::Tester, Exporter
Defined in:
lib/roadworker/utils.rb

Instance Method Summary collapse

Instance Method Details

#matched_zone?(name) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/roadworker/utils.rb', line 4

def matched_zone?(name)
  result = true

  # XXX: normalization should be happen on DSL as much as possible, but patterns expect no trailing dot
  # and to keep backward compatibility, removing then dot when checking patterns.
  name_for_patterns = name.sub(/\.\z/, '')

  if @options.exclude_zone
    result &&= name_for_patterns !~ @options.exclude_zone
  end

  if @options.target_zone
    result &&= name_for_patterns =~ @options.target_zone
  end

  result
end