Class: PostPolicy::Rule
- Inherits:
-
Object
- Object
- PostPolicy::Rule
- Defined in:
- lib/postpolicy/rule.rb
Overview
rule do
sender { format.value "[email protected]" }
recipient { format.regex /lomnicki.com.pl$/ }
action "REJECT"
end
Defined Under Namespace
Classes: Format
Class Method Summary collapse
Instance Method Summary collapse
- #action(value) ⇒ Object
-
#initialize(&block) ⇒ Rule
constructor
A new instance of Rule.
- #recipient(&block) ⇒ Object
- #sender(&block) ⇒ Object
- #to_access ⇒ Object
Constructor Details
#initialize(&block) ⇒ Rule
Returns a new instance of Rule.
38 39 40 |
# File 'lib/postpolicy/rule.rb', line 38 def initialize( &block ) instance_eval &block end |
Class Method Details
.rule(&block) ⇒ Object
42 43 44 |
# File 'lib/postpolicy/rule.rb', line 42 def self.rule( &block ) AccessManager << new( &block ).to_access end |
Instance Method Details
#action(value) ⇒ Object
54 55 56 |
# File 'lib/postpolicy/rule.rb', line 54 def action( value ) @rule_action = value end |
#recipient(&block) ⇒ Object
50 51 52 |
# File 'lib/postpolicy/rule.rb', line 50 def recipient( &block ) @rule_recipient = ACL::Recipient.new( Format.class_eval( &block ) ) end |