module Roadworker::Utils::Helper

Public Instance Methods

matched_zone?(name) click to toggle source
# 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