Class: Placet::PolicyBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/placet/dsl.rb

Overview

Ruby DSL(docs/rails-usage.md 2.2)。評価結果は正規形と等価な Definition になる

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePolicyBuilder

Returns a new instance of PolicyBuilder.



8
# File 'lib/placet/dsl.rb', line 8

def initialize = @statements = []

Instance Attribute Details

#statementsObject (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)