Class: Statement

Inherits:
Object
  • Object
show all
Defined in:
lib/cfn-model/model/statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStatement

Returns a new instance of Statement.



9
10
11
12
13
14
# File 'lib/cfn-model/model/statement.rb', line 9

def initialize
  @actions = []
  @not_actions = []
  @resources = []
  @not_resources = []
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



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

def actions
  @actions
end

#conditionObject

Returns the value of attribute condition.



4
5
6
# File 'lib/cfn-model/model/statement.rb', line 4

def condition
  @condition
end

#effectObject

Returns the value of attribute effect.



4
5
6
# File 'lib/cfn-model/model/statement.rb', line 4

def effect
  @effect
end

#not_actionsObject

Returns the value of attribute not_actions.



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

def not_actions
  @not_actions
end

#not_principalObject

Returns the value of attribute not_principal.



7
8
9
# File 'lib/cfn-model/model/statement.rb', line 7

def not_principal
  @not_principal
end

#not_resourcesObject

Returns the value of attribute not_resources.



6
7
8
# File 'lib/cfn-model/model/statement.rb', line 6

def not_resources
  @not_resources
end

#principalObject

Returns the value of attribute principal.



7
8
9
# File 'lib/cfn-model/model/statement.rb', line 7

def principal
  @principal
end

#resourcesObject

Returns the value of attribute resources.



6
7
8
# File 'lib/cfn-model/model/statement.rb', line 6

def resources
  @resources
end

#sidObject

Returns the value of attribute sid.



4
5
6
# File 'lib/cfn-model/model/statement.rb', line 4

def sid
  @sid
end

Instance Method Details

#==(another_statement) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/cfn-model/model/statement.rb', line 28

def ==(another_statement)
  @effect == another_statement.effect &&
    @actions == another_statement.actions &&
    @not_actions == another_statement.not_actions &&
    @resources == another_statement.resources &&
    @not_resources == another_statement.not_resources &&
    @principal == another_statement.principal &&
    @not_principal == another_statement.not_principal &&
    @condition == another_statement.condition
end

#wildcard_actionsObject



16
17
18
# File 'lib/cfn-model/model/statement.rb', line 16

def wildcard_actions
  @actions.select { |action| action.to_s =~ /\*/ }
end

#wildcard_principal?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/cfn-model/model/statement.rb', line 20

def wildcard_principal?
  Principal.wildcard? @principal
end

#wildcard_resourcesObject



24
25
26
# File 'lib/cfn-model/model/statement.rb', line 24

def wildcard_resources
  @resources.select { |action| action.to_s =~ /\*/ }
end