Top Level Namespace

Defined Under Namespace

Modules: AWS, Custom, References Classes: ApiGatewayDeploymentParser, ApiGatewayStageParser, CfnModel, CfnParser, CloudFormationValidator, Ec2InstanceParser, Ec2NetworkAclParser, 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

#not_truthy?(string) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/cfn-model/util/truthy.rb', line 9

def not_truthy?(string)
  string.nil? || string.to_s.casecmp('false').zero?
end

#truthy?(string) ⇒ Boolean

Checks a string for truthiness. Any cased ‘true’ will evaluate to a true boolean. Any other string _at all_ results in false.

Returns:

  • (Boolean)


5
6
7
# File 'lib/cfn-model/util/truthy.rb', line 5

def truthy?(string)
  string.to_s.casecmp('true').zero?
end

#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