Class: Passpartu::Verify
- Inherits:
-
Object
- Object
- Passpartu::Verify
- Defined in:
- lib/passpartu/verify.rb
Direct Known Subclasses
Constant Summary collapse
- CRUD_KEY =
'crud'.freeze
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#except ⇒ Object
readonly
Returns the value of attribute except.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(role, keys, except, block) ⇒ Verify
constructor
A new instance of Verify.
Constructor Details
#initialize(role, keys, except, block) ⇒ Verify
Returns a new instance of Verify.
6 7 8 9 10 11 |
# File 'lib/passpartu/verify.rb', line 6 def initialize(role, keys, except, block) @role = role.to_s @keys = keys.map(&:to_s) @except = Array(except).map(&:to_s) if present?(except) @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/passpartu/verify.rb', line 5 def block @block end |
#except ⇒ Object (readonly)
Returns the value of attribute except.
5 6 7 |
# File 'lib/passpartu/verify.rb', line 5 def except @except end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
5 6 7 |
# File 'lib/passpartu/verify.rb', line 5 def keys @keys end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
5 6 7 |
# File 'lib/passpartu/verify.rb', line 5 def result @result end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
5 6 7 |
# File 'lib/passpartu/verify.rb', line 5 def role @role end |
Class Method Details
.call(role, keys, except: nil, &block) ⇒ Object
13 14 15 |
# File 'lib/passpartu/verify.rb', line 13 def self.call(role, keys, except: nil, &block) new(role, keys, except, block).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/passpartu/verify.rb', line 17 def call return false if role_excepted? check_policy check_crud if policy_missed? && last_key_crud? validate_result end |