Class: Gitlab::Ci::EnvironmentMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/environment_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ EnvironmentMatcher

Returns a new instance of EnvironmentMatcher.



6
7
8
# File 'lib/gitlab/ci/environment_matcher.rb', line 6

def initialize(pattern)
  @pattern = pattern
end

Instance Method Details

#match?(environment) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/gitlab/ci/environment_matcher.rb', line 10

def match?(environment)
  return false if pattern.blank?

  exact_match?(environment) || wildcard_match?(environment)
end