Top Level Namespace

Defined Under Namespace

Modules: AWS, Custom, References Classes: ApiGatewayDeploymentParser, ApiGatewayStageParser, CfnModel, CfnParser, CloudFormationValidator, Ec2InstanceParser, Ec2NetworkInterfaceParser, ExpressionEvaluator, IamGroupParser, IamRoleParser, IamUserParser, KmsKeyParser, LambdaFunctionParser, LambdaPrincipal, LineNumberHandler, LoadBalancerParser, LoadBalancerV2Parser, ModelElement, Parameter, ParameterSubstitution, ParserError, ParserRegistry, Policy, PolicyDocument, PolicyDocumentParser, Principal, ReferenceValidator, ResourceTypeValidator, SchemaGenerator, SecurityGroupParser, Statement, ToRubyWithLineNumbers, WithPolicyDocumentParser

Instance Method Summary collapse

Instance Method Details

#wildcard_patterns(input, pattern_types: %w[front back both])) ⇒ Object

Create array of wildcard patterns for a given input string



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cfn-model/util/wildcard_patterns.rb', line 5

def wildcard_patterns(input, pattern_types: %w[front back both])
  input_string = input.to_s
  results = [input_string]
  pattern_types.each do |pattern_type|
    case pattern_type
    when 'front'
      results += wildcard_front(input_string)
    when 'back'
      results += wildcard_back(input_string)
    when 'both'
      results += wildcard_front_back(input_string)
    else
      raise "no pattern of type: #{pattern_type}. Use one or more of: front, back, both"
    end
  end
  results + ['*']
end