Class: AWS::Core::Policy::OperatorBuilder
- Inherits:
-
Object
- Object
- AWS::Core::Policy::OperatorBuilder
- Defined in:
- lib/aws/core/policy.rb
Overview
Convenient syntax for expressing operators in statement condition blocks. For example, the following:
policy.allow.where(:s3_prefix).not("forbidden").
where(:current_time).lte(Date.today+1)
is equivalent to:
conditions = Policy::ConditionBlock.new
conditions.add(:not, :s3_prefix, "forbidden")
conditions.add(:lte, :current_time, Date.today+1)
policy.allow(:conditions => conditions)
Instance Method Summary collapse
-
#initialize(condition_builder, key) ⇒ OperatorBuilder
constructor
A new instance of OperatorBuilder.
- #method_missing(m, *values) ⇒ Object
Constructor Details
#initialize(condition_builder, key) ⇒ OperatorBuilder
Returns a new instance of OperatorBuilder.
168 169 170 171 |
# File 'lib/aws/core/policy.rb', line 168 def initialize(condition_builder, key) @condition_builder = condition_builder @key = key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *values) ⇒ Object
173 174 175 176 |
# File 'lib/aws/core/policy.rb', line 173 def method_missing(m, *values) @condition_builder.conditions.add(m, @key, *values) @condition_builder end |