Class: Placet::PolicyBuilder
- Inherits:
-
Object
- Object
- Placet::PolicyBuilder
- Defined in:
- lib/placet/dsl.rb
Overview
Ruby DSL(docs/rails-usage.md 2.2)。評価結果は正規形と等価な Definition になる
Instance Attribute Summary collapse
-
#statements ⇒ Object
readonly
Returns the value of attribute statements.
Instance Method Summary collapse
- #allow(*actions) ⇒ Object
- #deny(*actions) ⇒ Object
-
#initialize ⇒ PolicyBuilder
constructor
A new instance of PolicyBuilder.
Constructor Details
#initialize ⇒ PolicyBuilder
Returns a new instance of PolicyBuilder.
8 |
# File 'lib/placet/dsl.rb', line 8 def initialize = @statements = [] |
Instance Attribute Details
#statements ⇒ Object (readonly)
Returns the value of attribute statements.
6 7 8 |
# File 'lib/placet/dsl.rb', line 6 def statements @statements end |
Instance Method Details
#allow(*actions) ⇒ Object
9 |
# File 'lib/placet/dsl.rb', line 9 def allow(*actions) = @statements << Statement.new(effect: "allow", actions: actions.flatten) |
#deny(*actions) ⇒ Object
10 |
# File 'lib/placet/dsl.rb', line 10 def deny(*actions) = @statements << Statement.new(effect: "deny", actions: actions.flatten) |